mongorito | 🍹 MongoDB ODM for Node.js apps based on Redux
kandi X-RAY | mongorito Summary
kandi X-RAY | mongorito Summary
Note: await won't work at top level, it's used to reduce the complexity of an example.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of mongorito
mongorito Key Features
mongorito Examples and Code Snippets
Community Discussions
Trending Discussions on mongorito
QUESTION
I am trying to write a register/login page in node.js using express.js. I have decided to split routes and app initialization into two files. When I send a POST request to localhost:3000/register
with the data {"username":"xyz","password":"xyz"}
, the request object has the attribute body. However when I try to access this attribute, I get undefined.
ANSWER
Answered 2020-Mar-12 at 04:24You have a small issue in you code. The router.post
callback function first parameter is req
and the second is res
. The Callback function
parameters are fixed not named parameters.
You are trying to get the body on the response object
, though the name of the parameter is req
but it still holds the response object
. which is causing the issue.
Please change it.
Wrong:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install mongorito
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page