Last updated
Last updated
We've integrated Axios to handle API calls. By default, it uses the current host URL, but you can customize this in the .env
file to suit your requirements.
Axios has been configured in the folder src/utils/axios.ts
We have our all API's in the src/app/api
directory. In this directory, there is a folder named auth
, which contains our authentication-related APIs.
The AUTH_PROVIDER
can be set to either mock
or supabase
. Both options utilize the same API endpoint, with the backend dynamically invoking the corresponding business logic based on the AUTH_PROVIDER
configuration.
The authProvider.ts
file manages this distinction by dynamically loading and returning the appropriate authentication provider module.
Below code defines a POST API route handler that dynamically invokes the appropriate login function based on the currently configured authentication provider.
For authentication, we have two distinct business logic implementations based on the selected AUTH_PROVIDER
:
Mock: The mock authentication logic is defined in src/app/api/mock/auth/index.ts
.
Supabase: The Supabase authentication logic is defined in src/app/api/supabase/auth/index.ts
.