• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

akheron/typera: Type-safe routes for Express and Koa

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

akheron/typera

开源软件地址:

https://github.com/akheron/typera

开源编程语言:

TypeScript 99.0%

开源软件介绍:

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.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap