From the course: Node.js: Securing RESTful APIs

Unlock the full course today

Join today to access over 22,700 courses taught by industry experts or purchase this course individually.

Finalize secured endpoints

Finalize secured endpoints

From the course: Node.js: Securing RESTful APIs

Start my 1-month free trial

Finalize secured endpoints

- [Instructor] So we need to add our routes for registration and log in, but also make sure we add the functions that will check for a logged in user before proceeding. So let's go ahead and work on this. For this particular code we're going to need to work in the routes. So go into the routes folder and then open the crmRoutes. And the first thing we're going to do is import the functions that we've created inside of the userController. So let's go ahead and do import and then what I'm going to do is do the from first, from dot dot controller, or controllers, userController, like so, and then what I can do is use that to import the functions in question. So for example we're going to have access to login. So if I type L I'm going to see login, and then register, and then loginRequired, and these are the functions that we need. So once we have these functions we can pass them to the routes. So what we're going to do is…

Contents