April 2020
Intermediate to advanced
716 pages
18h 55m
English
We will implement an API to get the expenses recorded by a specific user and incurred between a provided date range. The request for this API will be received at '/api/expenses', with the route defined in expense.routes.js as follows.
mern-expense-tracker/server/routes/expense.routes.js:
router.route('/api/expenses') .get(authCtrl.requireSignin, expenseCtrl.listByUser)
A GET request to this route will first ensure that the requesting user is signed in, before invoking the controller method to fetch the expenses from the database. In this application, users will only be able to view their own expenses. After the user authentication is confirmed, in the listByUser controller method we query the Expense collection in ...
Read now
Unlock full access