Created
June 20, 2018 16:23
-
-
Save DinoChiesa/ec37fc48c7ca169601acd3d52c811b85 to your computer and use it in GitHub Desktop.
nodejs hello world
This file contains hidden or 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 app = require('express')(), | |
bodyParser = require('body-parser'), | |
yes = require('yes-https'); // HSTS => https always | |
var gStatus = { | |
version : '20180619-1845' | |
}; | |
// HSTS on only if process.env.NODE_ENV == 'production' | |
app.use(yes()); | |
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