Skip to content

Instantly share code, notes, and snippets.

@fjctp
Last active November 29, 2017 05:14
Show Gist options
  • Save fjctp/223b8fa7141d42b610221d6936ab43fd to your computer and use it in GitHub Desktop.
Save fjctp/223b8fa7141d42b610221d6936ab43fd to your computer and use it in GitHub Desktop.
Simple Nodejs Server
FROM node:alpine
COPY server.js /
EXPOSE 80
ENTRYPOINT ["node", "/server.js"]
const http = require('http');
const port = 80;
const ser = http.createServer((req, res) => {
console.log(req.connection.remoteAddress + ' requested!');
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end('okay');
});
ser.listen(port, () => {
console.log('listening on port ' + port);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment