From the course: React: Authentication (2021)

Unlock the full course today

Join today to access over 24,400 courses taught by industry experts.

Adding an update user route

Adding an update user route - React.js Tutorial

From the course: React: Authentication (2021)

Adding an update user route

- [Tutor] So at this point, we have our signup and login pages both working, but as I'm sure you've noticed we have yet to actually make the main attraction of our app the user info page that is work. So let's take a look at how to incorporate the JSON web token logic that we've been using so far into this page as well. So the first step here is going to be to add another route to our backend. This is the route that the client will send requests to in order to actually modify the user's info. So inside our routes folder in our backend let's create another route. We'll call this route updateUserInfoRoute.js. And we're going to start off by importing a few things up at the top. We're going to import the JSON web token package. So import JWT from JSON web token. We're going to import something from the MongoDB package, right? It's going to be ObjectID. Don't worry too much about the details here. And we're also going to…

Contents