Last active
April 13, 2020 14:16
-
-
Save shijiezhou1/892ec21d1fbe3f7adc290190c8c1d28c to your computer and use it in GitHub Desktop.
Restifyjs Starter
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
// app.js | |
const http = require('http'); | |
// Create an instance of the http server to handle HTTP requests | |
let app = http.createServer((req, res) => { | |
// Set a response type of plain text for the response | |
res.writeHead(200, {'Content-Type': 'text/plain'}); | |
// Send back a response and end the connection | |
res.end('Hello World!\n'); | |
}); | |
// Start the server on port 3000 | |
app.listen(3000, '127.0.0.1'); | |
console.log('Node server running on port 3000'); | |
// To start | |
// node app.js | |
// pm2 app.js |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment