Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SailsJS req.body undefined

I use REST client apps in chrome to create a request using method POST: It's here:

http://localhost:1337/[email protected]&password=123123123&password_c=123123123

The results (req.body.email or req.body.password) return undefined when I log them in console What's problem? Here is my order in middleware for http request

 order: [
            'startRequestTimer',
            'cookieParser',
            'session',
            'myRequestLogger',
            'passportInit',
            'passportSession',
            'bodyParser',
            'handleBodyParserError',
            'compress',
            'methodOverride',
            'poweredBy',
            '$custom',
            'router',
            'www',
            'favicon',
            '404',
            '500'
        ],

Thanks all!

like image 225
henryhw Avatar asked Mar 07 '26 03:03

henryhw


1 Answers

req.body doesn't have data, your email and password is in your URL. You can have it by using req.params.email.

If this doesn't work, can you post your Controller that handle the route 'POST /signup'?

like image 91
M-A. Fernandes Avatar answered Mar 08 '26 17:03

M-A. Fernandes