Git Product home page Git Product logo

typera's Introduction

typera - Type-safe routes

Build

Typera helps you build backends in a type-safe manner by leveraging io-ts and some TypeScript type inference magic. It works with both Express and Koa.

Upgrading to version 2? See the upgrading instructions.

Features of typera in a nutshell:

  • A purer approach to building your apps: Each route handler is an async function that takes a request and returns a response. Mutable req or res objects? Never again!

  • Automatically parses request inputs like route params, query params, headers and request body into typed values.

  • Infer the types of responses (status code, body, headers), allow type checking them according to your expectations.

  • Middleware are fully typed. This means that you no longer have to guess what's available in req, or whether a middleware short-circuits and returns a response. Instead, everything is type checked!

  • It's straightforward to start adding fully typed routes to an existing Express or Koa app. Old routes can be migrated gradually.

  • Built-in support for automatically generating an OpenAPI definition from your app with typera-openapi.

Typera is a really thin layer on top of Express or Koa. Most of its code is TypeScript typings, and the actual runtime stuff is minimal.

See the documentation for tutorial, examples, API reference and more!

Development

Run yarn to install dependencies.

Running the test suite

Run yarn test.

Documentation

You need Python 3 to build the docs.

python3 -m venv venv
./venv/bin/pip install mkdocs-material

Run a live reloading server for the documentation:

./venv/bin/mkdocs serve

Open http://localhost:8000/ in the browser.

Releasing

$ yarn lerna version <major|minor|patch>
$ yarn lerna publish from-git

Open https://github.com/akheron/typera/releases, edit the draft release, select the newest version tag, adjust the description as needed.

typera's People

Contributors

dependabot[bot] avatar akheron avatar rjoonas avatar ajmnz avatar gabeatwork avatar raine avatar tsheaff avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.