Skip to content

Instantly share code, notes, and snippets.

@vdurmont
Created November 26, 2013 19:23
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 vdurmont/7664504 to your computer and use it in GitHub Desktop.
Save vdurmont/7664504 to your computer and use it in GitHub Desktop.
main file for a basic express.js API
var express = require('express');
var routes = require('./routes.js');
var app = express();
app.use(express.bodyParser());
app.get('/', routes.getAll);
app.post('/', routes.create);
app.get('/:id', routes.get);
app.put('/:id', routes.update);
app.del('/:id', routes.del);
app.listen(3333);
console.log('Running on port 3333!');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment