Created
June 4, 2012 18:15
-
-
Save ovaillancourt/2869962 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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