Skip to content

Instantly share code, notes, and snippets.

@Adurtxi
Last active July 22, 2021 11:51
Show Gist options
  • Select an option

  • Save Adurtxi/a07d8e2e0e932d8f7c4bc1ceeb3f6e23 to your computer and use it in GitHub Desktop.

Select an option

Save Adurtxi/a07d8e2e0e932d8f7c4bc1ceeb3f6e23 to your computer and use it in GitHub Desktop.
Example server with nodejs
const http = require('http');
const hostname = 'localhost';
const port = 3000;
const server = http.createServer((req, res) => {
res.statusCode = 200;
res.setHeader('Content-Type', 'text/plain');
res.end('NodeJS works in Nginx!\n');
});
server.listen(port, hostname, () =>
console.log(`Server running at http://${hostname}:${port}/`)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment