Last active
November 29, 2017 05:14
-
-
Save fjctp/223b8fa7141d42b610221d6936ab43fd to your computer and use it in GitHub Desktop.
Simple Nodejs Server
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
FROM node:alpine | |
COPY server.js / | |
EXPOSE 80 | |
ENTRYPOINT ["node", "/server.js"] |
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
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