Created
November 23, 2018 18:49
-
-
Save vipulbhj/05a89376ce0f8b9265989b678fd05c54 to your computer and use it in GitHub Desktop.
Basic Node JS server using http module.
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
const http = require('http'); | |
const PORT = process.env.PORT || 5000; | |
const app = http.createServer((req, res) => { | |
res.writeHead(200, { 'Content-Type': 'text/html' }); | |
res.write("Hello World"); | |
res.end(); | |
}); | |
app.listen(PORT, () => { | |
console.log(`Server is running on port ${PORT}`); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http gist