Communication with the backend API is implemented through the client in ApiClient.ts
. It's an autogenerated file that contains all required methods and types for work with API.
Auto-generation is done through the NSwag package which uses the open API documentation to generate typescript client code. NSwag is listed as a dev dependency in this project.
nswag.json
contains required configuration.
After any changes to the API contract (new endpoints, URL changes, requests, or return types) ApiClient needs to be regenerated to reflect these changes.
- Start the API on your local machine *
- Ensure url
/swagger
is working properly - Run command:
node_modules/.bin/nswag run
- Check changes in
ApiClinet.ts
- Fix all broken code dependencies on ApiClient
* you can specify exact location in nswag.json