Set up an HTTP client to query the cbld-api repo and handle the response.
There may be more clients in the future, so it would be useful to reserve a src/clients folder this and future clients.
The client should abstract the developer from the internal workings of the api as much as possible.
All requests to the cbld API should be proxied via the frontend app's own api layer (corresponding to nexts serverless methods in, for example, src/app/api folder. For example: the client would not make a request directly to https://some-domain/api/v0/projects, but rather to a local handler, e.g. /api/projects. To that end, it would be easier to design a single handler that forwards all requests, rather than create a handler for each request.
Include unit tests to cover the client and response handling logic.
Acceptance criteria
[ ] the URL to the backend api is an environment variable
Set up an HTTP client to query the cbld-api repo and handle the response.
src/clients
folder this and future clients.src/app/api
folder. For example: the client would not make a request directly tohttps://some-domain/api/v0/projects
, but rather to a local handler, e.g./api/projects
. To that end, it would be easier to design a single handler that forwards all requests, rather than create a handler for each request.Include unit tests to cover the client and response handling logic.
Acceptance criteria