Retyped routes provides a type-safe way to create API definitions with retype in a way that can be read both by the server and client.
yarn add @withgraphite/retyped-routes
import * as t from "@withgraphite/retype";
import { asRouteTree } from "@withgraphite/retyped-routes";
const API_ROUTES = asRouteTree({
login: {
method: "POST",
url: "/auth",
params: {
email: t.string,
password: t.string,
},
response: {
token: t.string,
},
},
} as const);
export default API_ROUTES;
Copyright 2021, Screenplay Studios Inc.