Reputation: 81
i am trying to create user login and registration using node express and mongoose... created the User Model....trying now to add a post method in my router auth.js but for some reason i keep getting the error Cannot read property 'name' of undefined yesterday i wrote exactly the same code, but with some other post methods and it went perfectly fine....
i just want the post to work on postman for now that's it...thanks alot
Upvotes: 1
Views: 4724
Reputation: 81
it turned out that the order of the middleware counts here...i just moved the app.use(express.json()) before the routes add ,,,,and it went fine....thanks Subburaj...appreciate your help :)
Upvotes: 5