Last active
February 26, 2018 20:17
-
-
Save AlirezaAkbarix/fe9be82bb944ef278e7e5286a418df99 to your computer and use it in GitHub Desktop.
NodeJs Getting Started (Creating an empty Server)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// #First HomeWork :) | |
const | |
http = require('http'), | |
host= '127.0.0.1', | |
port = 2999, // For showing my Creativity! | |
server = http.createServer( (req , res)=>{ | |
res.statusCode = 200; | |
res.setHeader('Content-Type','text/html'); | |
res.write('<p>Dalam :)</p>'); | |
res.write('<p>Will it go to the next line?</p>'); | |
res.write('<p>It <b>didn\'t</b> unless I used html</p>'); | |
res.end(); | |
}), | |
createMyServer = ()=>{ | |
server.listen(3000,'127.0.0.1', ()=>{ | |
console.log('Can anyone say why PORT is the first argument? :|'); | |
}); | |
}; | |
createMyServer(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment