Skip to content

API module

Dmitry Usik edited this page Apr 3, 2022 · 13 revisions

Base layer

The project contains the base layer for axios which can be configured in axiosBase.ts. The main methods (get, post, put) from the HTTP protocol are implemented. The other methods could be also implemented based on demand.

Layers

If the API you're using has a different business logic part then you need to separate them between different folders. Let's overview the files from the countries folder.

API

All the API requests should be implemented in countriesApi.ts using the methods from the base layer.

Types

All the remote types should be specified in types.ts.

Config

All the API-related constants should be kept in config.ts.

Base URL

The base URL can be configured in axiosBase.ts.

Clone this wiki locally