Closed AltynDaur closed 8 years ago
hey there ,
I was stuck at the same place as you . The solution is to put the
req.body.str.split('').reverse().join('');
inside
res.end(req.body.str.split('').reverse().join('') );
I will post my code below hope that helps
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]);
Thank you so much! It was little dumb mistake))
Glad I was able to help you :)
Here my code: var express = require('express'),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]);
When I tried verify this code, I've got this: events.js:85 throw er; // Unhandled 'error' event ^ Error: socket hang up at createHangUpError (_http_client.js:215:15) at Socket.socketOnEnd (_http_client.js:300:23) at Socket.emit (events.js:129:20) at _stream_readable.js:908:16 at process._tickCallback (node.js:355:11)