-
Notifications
You must be signed in to change notification settings - Fork 392
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot get any data into any Post method #56
Comments
Right, so it turned out to be partially an express.js issue - where the bodyParser needs to be registered in the right order to other middlware e.g. router. I have opted to switch from createExpressServer() to useExpressServer() to have more control of the initialization process. I suspect the createES() method has an issue somewhere. Anyway, hope it;ll help someone as I was going a little bit mad. |
Express 4.x is modular so you need to have eg. body-parser and cookie-parser installed and loaded explicitly by yourself. It's not |
That is correct. Thanks for the input. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
I have a very simple controller method
@Post("/register") register(@Req() request: any, @Res() response: any) { console.log(JSON.stringify(request.body)); return ""; }
and I'm trying to pass in some post data using the curl CLI iunder windows:
curl -X POST -H "Content-Type: application/json" -d "{ \"email\": \"lergfdl@gmail.com\", \"name\": \"john\", \"password\": \"1\" }" localhost:8080/api/auth/register
Somehow I cannot for the life of me get any of the data to come through i.e. the body is a l w a y s empty.
I have absolutely no idea where the problem is as the @get methods work no problem.
Please advise.
Thansk you so much.
The text was updated successfully, but these errors were encountered: