Skip to content

Instantly share code, notes, and snippets.

@yoyu777
Created October 17, 2021 19:33
Show Gist options
  • Save yoyu777/3fce7e75e809089965f184994dab201d to your computer and use it in GitHub Desktop.
Save yoyu777/3fce7e75e809089965f184994dab201d to your computer and use it in GitHub Desktop.
http_server.js
/*
//it is necessary to start a web server,
//so App Engine is happy
*/
const http = require('http');
const hostname = '0.0.0.0';
const port = process.env.PORT;
const server = http.createServer((req, res) => {
res.statusCode = 200;
res.setHeader('Content-Type', 'text/plain');
res.end('The server has started');
});
server.listen(port, hostname, () => {
console.log(`Server running at http://${hostname}:${port}/`);
});
/*
End of web server
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment