exportconst api = createApiClient({
baseUrl: "your-app.com/api"
});
const result = api.get("/some-path");
const onClick = () => api.delete("/some-other-path");
I pair it with @davekit/typesafe-api and generate types for all my backend routes that I can then import into the frontend and get type-safety over the API. But that needs a whole blog post of its own to get into.