Last active
December 19, 2016 00:50
-
-
Save viebig/14249d3445aff6e9beb650e16f0704e9 to your computer and use it in GitHub Desktop.
sum12factor index.js v2 dotenv
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 restify = require('restify'); | |
| const plugins = require('restify-plugins'); | |
| require('dotenv').config() | |
| const server = restify.createServer(); | |
| server.use(plugins.acceptParser(server.acceptable)); | |
| server.use(plugins.bodyParser()); | |
| server.post('/sum', (req, res, next) => { | |
| res.send(200, req.body.reduce((a, b) => a + b, 0)); | |
| return next(); | |
| }); | |
| server.listen(process.env.RESTIFY_SEVER_PORT); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment