Created
November 1, 2010 21:12
-
-
Save michael/658885 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
var express = require('express@1.0.0rc4'); | |
var app = express.createServer(); | |
var http = require('http'); | |
var cradle = require('cradle@0.2.2'); | |
var conn = new(cradle.Connection); | |
var db = conn.database('document_composer'); | |
// Create a document | |
app.post('/documents', function(req, res) { | |
console.log(req.headers['content-type']); | |
console.log(req.body); | |
res.send('test'); | |
}); | |
app.configure(function(){ | |
app.use(express.methodOverride()); | |
app.use(express.bodyDecoder()); | |
app.use(app.router); | |
app.use(express.staticProvider(__dirname)); | |
}); | |
app.listen(3003); | |
// Output | |
application/x-www-form-urlencoded | |
undefined |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
app.post() (or the others) will cause the app.router middleware to be mounted. this allows for small sites to omit
app.use(app.router)
, but in your case here you wantapp.configure()
above your route