import { routes, type, empty } from 'routopia';
export const api = routes({
"/path": {
get: empty,
},
"/path/[id]": {
get: {
params: {
id: type as number,
},
queries: {
q: type as string | undefined,
},
},
},
});
import { api } from "./path/to/api";
api["/path"].get();
api["/path/[id]"].get({
params: { id: 123 },
queries: { q: "query" },
});
api["/path/[id]"].get({
params: { id: 123 },
});
api["/path/[id]"].get();