serverUp - Python


Sat Feb 26 2022 08:28:58 GMT+0000 (UTC)

Saved by @ghefley #https #server #javascript #serverup #snippet

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, '');
console.log('Node server running on port 3000');

Everywhere. It is simple and works. You can get the same affect by $->python -m http.server