Created
June 21, 2018 10:34
-
-
Save jackhickey/32d9a9fa04f8b9daac51ec64a956357e to your computer and use it in GitHub Desktop.
native nodejs health endpoint
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 server = http.createServer((req, res) => { | |
if(req.url === '/health') { | |
res.setHeader('Content-Type', 'application/json'); | |
res.end(new Buffer.from(JSON.stringify({status: 'UP'}))); | |
} else { | |
res.statusCode = 404; | |
res.end('Not Found\n'); | |
} | |
}); | |
server.listen(3999); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment