Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ===/ Dependencies ==========================================================
- var express = require("express");
- var app = express.createServer();
- app.configure( function() {
- app.use(express.logger());
- app.use(express.bodyParser());
- app.use(express.methodOverride());
- app.use(app.router);
- app.use(express.static(__dirname + '/public'));
- });
- // ===/ Routes ================================================================
- /* --------------------------------------------------------------------------
- * Root - redirect to /index.html
- * -------------------------------------------------------------------------- */
- app.get('/', function(req, res){
- console.log("[redirect] /index.html");
- res.redirect("/index.html");
- });
- /* --------------------------------------------------------------------------
- * Authenticate the user
- * -------------------------------------------------------------------------- */
- app.post('/profile/authenticate', function(req, res){
- var body = req.body;
- console.log(body); /// <===================================================== req.body is always undefined
- res.writeHeader(200, {'content-type' : 'text/plain'});
- res.write("hmm");
- res.end("\n");
- });
- // ===/ Startup ===============================================================
- app.listen(3000);
- console.log("Express server listening on port %d in %s mode", app.address().port, app.settings.env);
Add Comment
Please, Sign In to add comment