Routing
Routing in the system is based on Express, and processing is handled in the /routes/ files, starting with index.ts.
Important! There is an intermediate nginx layer on the servers that handles all HTTP(S) requests except those added to exceptions (see /docs/gocore-v2.0/kak-nachat/parametry-config.json).
The system already defines the routes necessary for operation, including the API.
API
The route looks like this: /api/v1/:className/:command. Only POST requests are processed.
upload/files
The system handles file uploads, including to non-public areas, as well as their downloading if access is granted.
When adding new routes, add them to the end of the file and move the logic to separate files in the same directory.
Middleware
Crossorigin
This middleware allows filtering cross-origin requests. The list of allowed domains is defined via the interface: Settings -> Origin.
loadUser
Allows loading the user session. Mandatory for authorized requests.