1

Implementing a RESTful API, and have setup a file structure like so:

|-- api
    `-- entity
        |-- models.d.ts
        |-- models.ts
        `-- routes.ts

Admin/sudo routes could go in api/admin/entity_name.ts or api/entity/admin.ts.

Former is useful because all admin controls are in one place, easier to audit, standardise, turn off all admin access &etc. Latter is handy because it's very close to the "normal user" implementation.

Which option is best?

A T
  • 13,008
  • 21
  • 97
  • 158
  • These admin routes are specifically for batch processing—e.g.: show me all users, add role `x` to all users—rather than simply about admin access on a per entity basis, which would be better handled by adding all logic in the `edit_one_user` route, only allowing admins to edit users other than themselves. – A T Jan 14 '16 at 09:58

0 Answers0