0.3.7 • Published 2 years ago

@withgraphite/retyped-routes v0.3.7

Weekly downloads
-
License
None
Repository
github
Last release
2 years ago

Retyped routes (beta)

About

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.

Install

yarn add @withgraphite/retyped-routes

Usage

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;

License

Copyright 2021, Screenplay Studios Inc.