Skip to content

Instantly share code, notes, and snippets.

@viebig
Last active December 19, 2016 00:50
Show Gist options
  • Select an option

  • Save viebig/14249d3445aff6e9beb650e16f0704e9 to your computer and use it in GitHub Desktop.

Select an option

Save viebig/14249d3445aff6e9beb650e16f0704e9 to your computer and use it in GitHub Desktop.
sum12factor index.js v2 dotenv
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