Skip to content

Instantly share code, notes, and snippets.

@lrlna
Created August 11, 2017 10:41
Show Gist options
  • Select an option

  • Save lrlna/2a2b2ddf976408fe5faacc8502893998 to your computer and use it in GitHub Desktop.

Select an option

Save lrlna/2a2b2ddf976408fe5faacc8502893998 to your computer and use it in GitHub Desktop.
var merry = require('merry')
var app = merry()
app.route('GET', '/', function (req, res, ctx) {
ctx.send(200, { subject: '/ butts' })
})
app.route('GET', '/download', function (req, res, ctx) {
res.setHeader('Content-Disposition', 'attachment')
ctx.send(200, { subject: 'butts getting downloaded' })
})
app.route('default', function (req, res, ctx) {
ctx.log.info('Route doesnt exist')
ctx.send(404, { message: 'nada here' })
})
app.listen(8080)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment