API
API action
Overview
API action — is HTTP handler that perform database updates and other logic required by the business logic.
Actions should reside in the /actions
folder within resource.
Usually action is a single file that has meaningful name, e.x. list
, get-by-id
, update-email
.
If action has a lot of logic and require multiple files it needs to be placed into the folder with name of the action and action need to exposed using module pattern (index.ts file).
Direct database updates of the current resource entity are allowed within action.