0.3.2 • Published 10 months ago
api-typify v0.3.2
Examples
// api.ts
const routes = {
GET: {
"/users/{id}": {
req: undefined, // Requests body type
res: User, // Response type
},
},
};
const api = getAPI<typeof routes>(
"https://api.example.com",
fetch,
);
// Get's the user object
const user = await api.get("/users/{id}", {
params: {
id: "123",
},
});