Packages
@routess/api-client
HTTP client for the Routess API.
A thin wrapper over fetch with typed methods for the Routess API.
Exports
| Entry point | Use it for |
|---|---|
@routess/api-client | Client factory, adapters, services and API types |
Usage
import { createApiClient } from "@routess/api-client";
const api = createApiClient({ baseUrl: import.meta.env.VITE_API_URL });
const me = await api.getProfile();
const routes = await api.getRoutes();Error handling
All client methods throw ApiError on non-2xx responses. The error includes:
status: HTTP status codecode: machine-readable error code from the APImessage: human-readablefieldErrors?: for 422 validation errors