DEV Community

Discussion on: Authentication in NodeJS With Express and Mongo - CodeLab #1

Collapse
 
chilupa profile image
Pavan Chilukuri • Edited

Fantastic article. Covered all major topics - Sign up, Login, Authentication using JWT, MongoDB through this app.

Here are few changes that I had to do as mLab is now part of MongoDB family.

  • Created an account with MongoDB Atlas
  • Created a cluster
  • In the cluster creation process, it will let you choose the type of Sandbox, AWS region. Once you are done with it, it will ask to create user and password for the database.
  • After created user and password, use the Connect to Application option which helps you select the type of app. Here it is Node and it will only give you the URI. I simply copied that URI to the MongoURI in the code (config/db.js)
  • Also, in routes/user.js file, I had to add this line at the end of file.
module.exports = router;
Enter fullscreen mode Exit fullscreen mode

Hope this will help someone like me 😉

Collapse
 
dipakkr profile image
Deepak Kumar

Yes, you are right! thanks for sharing !!

This is the process for new users.

Collapse
 
grsarvesh profile image
GRSARVESH

POST localhost:3000/undefined/user/regi... 404 (Not Found)
dispatchXhrRequest @ xhr.js:178
xhrAdapter @ xhr.js:12
dispatchRequest @ dispatchRequest.js:52
Promise.then (async)
request @ Axios.js:61
Axios. @ Axios.js:86
wrap @ bind.js:9
sendDetailsToServer @ RegistrationForm.js:28
handleSubmitClick @ RegistrationForm.js:61
callCallback @ react-dom.development.js:188
invokeGuardedCallbackDev @ react-dom.development.js:237
invokeGuardedCallback @ react-dom.development.js:292
invokeGuardedCallbackAndCatchFirstError @ react-dom.development.js:306
executeDispatch @ react-dom.development.js:389
executeDispatchesInOrder @ react-dom.development.js:414
executeDispatchesAndRelease @ react-dom.development.js:3278
executeDispatchesAndReleaseTopLevel @ react-dom.development.js:3287
forEachAccumulated @ react-dom.development.js:3259
runEventsInBatch @ react-dom.development.js:3304
runExtractedPluginEventsInBatch @ react-dom.development.js:3514
handleTopLevel @ react-dom.development.js:3558
batchedEventUpdates$1 @ react-dom.development.js:21871
batchedEventUpdates @ react-dom.development.js:795
dispatchEventForLegacyPluginEventSystem @ react-dom.development.js:3568
attemptToDispatchEvent @ react-dom.development.js:4267
dispatchEvent @ react-dom.development.js:4189
unstable_runWithPriority @ scheduler.development.js:653
runWithPriority$1 @ react-dom.development.js:11039
discreteUpdates$1 @ react-dom.development.js:21887
discreteUpdates @ react-dom.development.js:806
dispatchDiscreteEvent @ react-dom.development.js:4168
RegistrationForm.js:43 Error: Request failed with status code 404
at createError (createError.js:16)
at settle (settle.js:17)
at XMLHttpRequest.handleLoad (xhr.js:61)
HELP ME OUT!
sIGNUP , LOGIN BUTTONS ARENT WORKING .They are showing this error

Collapse
 
mikeypenny profile image
Miguel Sandoval

:):):):):):):):):):):):):):)

Collapse
 
grsarvesh profile image
GRSARVESH

i stiill didnt get to know on how you connected front and backend.plz let me now

Collapse
 
nanasv profile image
Nana aka y_chris

It's really going to ,cause am having a hard creating the URI from mLab thanks.