Skip to content

Instantly share code, notes, and snippets.

@ovaillancourt
Created June 4, 2012 18:15
Show Gist options
  • Save ovaillancourt/2869962 to your computer and use it in GitHub Desktop.
Save ovaillancourt/2869962 to your computer and use it in GitHub Desktop.
#!/usr/bin/env node
var application_root = __dirname,
express = require("express"),
path = require("path");
var app = express.createServer();
// Config
app.configure(function () {
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(app.router);
app.use(express.static(path.join(application_root, "../public"))); //This allows us to server static files!
//The magic happens here
app.use(function(req,res ,next){
res.send('404 page here!');
});
//And ends here :P
app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
});
app.get('/api', function (req, res) {
res.send('API is running');
});
// Launch server
app.listen(3000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment