Create PageRoute and PageNodeRoute middleware #18

Closed
opened 4 years ago 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 4 years ago
garrettmills closed this issue 4 years ago
Sign in to join this conversation.
Loading…
There is no content yet.