The user API endpoints exposed by the Express app will allow the frontend to perform CRUD operations on documents that are generated according to the user model. To implement these working endpoints, we will write Express routes and the corresponding controller callback functions that should be executed when HTTP requests come in for these declared routes. In this section, we will look at how these endpoints work without any auth restrictions.
Our user API routes will be declared using the Express router in server/routes/user.routes.js, and then mounted on the Express app we configured in server/express.js.
mern-skeleton/server/express.js:
import userRoutes from './routes/user.routes'
...
app.use('/', userRoutes)
...
All routes and API endpoints, such as the user-specific routes we'll declare next, need to be mounted on the Express...