Toggle navigation
Toggle navigation
This project
Loading...
Sign in
MotherProject
/
myYoutube
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Flare-k
2020-05-15 19:32:18 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
2bea5b0757db456224355abf35ce5da35b5cbf79
2bea5b07
1 parent
102597d6
Add babel and middleware
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
6 deletions
.babelrc
index.js
package.json
.babelrc
0 → 100644
View file @
2bea5b0
{
"presets"
:
[
"@babel/preset-env"
]
}
/*
원하는
node.js와
JS와
관련된
모든
설정을
집어넣는다.
이
파일은
Babel을
설정하는
곳이다.
Babel이
실행되기
전에
이
파일을
찾아보고
설정해둔
Preset을
읽고
이해한다.
Preset에
따라
변환한다.
*/
\ No newline at end of file
index.js
View file @
2bea5b0
const
express
=
require
(
"express"
);
import
express
from
"express"
;
import
morgan
from
"morgan"
;
import
helmet
from
"helmet"
;
import
cookieParser
from
"cookie-parser"
;
import
bodyParser
from
"body-parser"
;
const
app
=
express
();
const
PORT
=
80
;
...
...
@@ -6,4 +11,15 @@ function handleListening() {
console
.
log
(
`Listening on: http://localhost:
${
PORT
}
`
);
}
const
sayHello
=
(
req
,
res
)
=>
res
.
send
(
"Hello~!"
);
app
.
use
(
cookieParser
());
app
.
use
(
bodyParser
.
json
());
app
.
use
(
bodyParser
.
urlencoded
({
extended
:
true
}));
app
.
use
(
helmet
());
app
.
use
(
morgan
(
"dev"
));
app
.
get
(
'/'
,
sayHello
);
app
.
listen
(
PORT
,
handleListening
);
\ No newline at end of file
...
...
package.json
View file @
2bea5b0
...
...
@@ -4,7 +4,7 @@
"description"
:
"make Youtube Website"
,
"main"
:
"index.js"
,
"scripts"
:
{
"
test"
:
"echo
\"
Error: no test specified
\"
&& exit 1
"
"
start"
:
"nodemon --exec babel-node index.js --delay 2
"
},
"repository"
:
{
"type"
:
"git"
,
...
...
@@ -13,9 +13,16 @@
"author"
:
"Kang Yeon Wook"
,
"license"
:
"ISC"
,
"dependencies"
:
{
"express"
:
"^4.17.1"
"@babel/core"
:
"^7.9.6"
,
"@babel/node"
:
"^7.8.7"
,
"@babel/preset-env"
:
"^7.9.6"
,
"body-parser"
:
"^1.19.0"
,
"cookie-parser"
:
"^1.4.5"
,
"express"
:
"^4.17.1"
,
"helmet"
:
"^3.22.0"
,
"morgan"
:
"^1.10.0"
},
"
script
s"
:
{
"
start"
:
"node index.js
"
"
devDependencie
s"
:
{
"
nodemon"
:
"^2.0.4
"
}
}
\ No newline at end of file
}
...
...
Please
register
or
login
to post a comment