Skip to content

Instantly share code, notes, and snippets.

@jmgunn87
Created May 25, 2012 16:02
Show Gist options
  • Save jmgunn87/2788946 to your computer and use it in GitHub Desktop.
Save jmgunn87/2788946 to your computer and use it in GitHub Desktop.
npm install mongoose director
var http = require('http');
var url = require('url');
var director = require('director');
var router = new director.http.Router();
var db = require('mongoose');
db.connect('mongodb://localhost/ecomm_database');
router.get('/:eventId', function (eventId){
this.res.end(eventId);
});
router.get('/:eventId/attractions', function (eventId){
this.res.end(eventId);
});
router.get('/:eventId/checkin', function (eventId){
this.res.end(eventId);
});
router.get('/:eventId/checkins', function (eventId){
this.res.end(eventId);
});
router.get('/:eventId/related', function (eventId){
this.res.end(eventId);
});
router.get('/:eventId/vote', function (eventId){
this.res.end(eventId);
});
router.get('/:eventId/wall', function (eventId){
this.res.end(eventId);
});
var server = http.createServer (function (request, response){
router.dispatch (request, response, function (error) {
if (error) {
response.writeHead (404);
response.end ();
}
});
}).listen (80);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment