Created
September 15, 2011 14:18
-
-
Save deedubs/1219351 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
Express.createServer(Express.static(__dirname + '/../public'), form(), Express.logger(), Express.cookieParser(), Express.session({ | |
secret: '...', | |
store: this.sessionStore | |
}), Express.bodyParser()); |
This file contains hidden or 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
module.exports = { | |
index: function(req, res) { | |
if (req.form) { | |
return req.form.onComplete = function(err, fields, files) { | |
res.writeHead(200, {}); | |
if (err) { | |
res.write(JSON.stringify(err.message)); | |
} | |
res.write(JSON.stringify(fields)); | |
res.write(JSON.stringify(files)); | |
return res.end(); | |
}; | |
} else { | |
return res.send(200); | |
} | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment