Create PageRoute and PageNodeRoute middleware #18

Closed
opened 2020-11-03 02:10:51 +00:00 by garrettmills · 0 comments
Owner

A lot of controller methods require a page and/or a node ID to be specified. This leads to a lot of duplicate code. Let's clean that up by creating middlewares do the following:

  1. Retrieve the PageId from the params
  2. Try to look up that page. If not exists, return 404 API error
  3. If exists, check user access. If not accessible, return 401 API error
    • allow passing in the access level as a parameter
  4. If accessible, set req.noded.page and/or req.noded.node
A lot of controller methods require a page and/or a node ID to be specified. This leads to a lot of duplicate code. Let's clean that up by creating middlewares do the following: 1. Retrieve the PageId from the params 2. Try to look up that page. If not exists, return 404 API error 3. If exists, check user access. If not accessible, return 401 API error - allow passing in the access level as a parameter 4. If accessible, set `req.noded.page` and/or `req.noded.node`
garrettmills added the
Feature Request
Scope: APIs
labels 2020-11-03 02:10:51 +00:00
garrettmills added the
Deployed to: Production
Deployed to: Staging
labels 2020-11-16 03:22:31 +00:00
Sign in to join this conversation.
No description provided.