Skip to content

Instantly share code, notes, and snippets.

@DinoChiesa
Last active June 20, 2018 16:23
Show Gist options
  • Save DinoChiesa/3cae5caef303b41238da4886d3a7e487 to your computer and use it in GitHub Desktop.
Save DinoChiesa/3cae5caef303b41238da4886d3a7e487 to your computer and use it in GitHub Desktop.
nodejs hello world
const app = require('express')(),
bodyParser = require('body-parser');
var gStatus = {
version : '20180619-1845'
};
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.get('/status', function(request, response) {
...
});
...
const port = process.env.PORT || 5950;
const server = app.listen(port, function() {
log.setLevel(3);
log.write(0, "service version %s listening on port %s", gStatus.version, server.address().port);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment