azat-co / expressworks

Learn Express.js from the author of one of the best books on Express.js—Pro Express.js— with this workshop that will teach you basics of Express.js.
MIT License
709 stars 220 forks source link

Good Old Form #80

Closed ankitverma2211 closed 8 years ago

ankitverma2211 commented 8 years ago

My Code :

var express = require('express') var bodyparser = require('body-parser') var app = express() app.use(bodyparser.urlencoded({extended:false})) app.post('/form',function(req,res){

    req.body.str.split('').reverse().join('')

})

app.listen(process.argv[2]);

Its not running in the terminal Its hanging up

ankitverma2211 commented 8 years ago

Fixed it the solution is below

var express = require('express') var bodyparser = require('body-parser') var app = express() app.use(bodyparser.urlencoded({extended:false})) app.post('/form',function(req,res){

    res.end(req.body.str.split('').reverse().join('') );

})

app.listen(process.argv[2]);