Toggle navigation
Toggle navigation
This project
Loading...
Sign in
I_Jemin
/
Node-Study
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
I_Jemin
2018-03-22 01:04:57 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
061e240757b0f71aa659a3d3a744b91528394b6e
061e2407
1 parent
e969f004
Handle routes
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
4 deletions
app.js
app.js
View file @
061e240
const
http
=
require
(
'http'
);
const
server
=
http
.
createServer
();
const
server
=
http
.
createServer
((
req
,
res
)
=>
{
if
(
req
.
url
===
'/'
)
{
res
.
write
(
'Hello World'
);
res
.
end
();
}
if
(
req
.
url
===
'/api/courses'
)
{
res
.
write
(
JSON
.
stringify
([
1
,
2
,
3
]));
res
.
end
();
}
});
server
.
on
(
'connection'
,(
socket
)
=>
{
console
.
log
(
'New Connection...'
);
}
);
server
.
listen
(
3000
);
...
...
Please
register
or
login
to post a comment