Skip to content

Instantly share code, notes, and snippets.

@yamikuronue
Created November 30, 2015 23:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yamikuronue/d307e44f2d17c086a6b4 to your computer and use it in GitHub Desktop.
Save yamikuronue/d307e44f2d17c086a6b4 to your computer and use it in GitHub Desktop.
//Set up middleware
const bodyParser = require('body-parser');
let jsonParser = bodyParser.json();
//Attach to route
app.route('/api/boards')
.get(cApi.getAllBoards)
.post(jsonParser, cApi.addBoard)
.patch((_, res) => res.status(405).end())
.delete((_, res) => res.status(405).end())
.put((_, res) => res.status(405).end());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment