All Projects → toajs → Toa

toajs / Toa

Licence: mit
A pithy and powerful web framework.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Toa

Echo
High performance, minimalist Go web framework
Stars: ✭ 21,297 (+9580.45%)
Mutual labels:  middleware, web-framework
Blog App Buffalo
A blogging app built with Buffalo.
Stars: ✭ 27 (-87.73%)
Mutual labels:  middleware, generator
Iris
The fastest HTTP/2 Go Web Framework. AWS Lambda, gRPC, MVC, Unique Router, Websockets, Sessions, Test suite, Dependency Injection and more. A true successor of expressjs and laravel | 谢谢 https://github.com/kataras/iris/issues/1329 |
Stars: ✭ 21,587 (+9712.27%)
Mutual labels:  middleware, web-framework
Jeff
🍍Jeff provides the simplest way to manage web sessions in Go.
Stars: ✭ 223 (+1.36%)
Mutual labels:  middleware, web-framework
Rubico
[a]synchronous functional programming
Stars: ✭ 133 (-39.55%)
Mutual labels:  async-await, generator
nardis
A small web framework based on ASGI
Stars: ✭ 14 (-93.64%)
Mutual labels:  web-framework, async-await
Kretes
A Programming Environment for TypeScript & Node.js built on top of VS Code
Stars: ✭ 570 (+159.09%)
Mutual labels:  async-await, web-framework
Clevergo
👅 CleverGo is a lightweight, feature rich and high performance HTTP router for Go.
Stars: ✭ 246 (+11.82%)
Mutual labels:  middleware, web-framework
Clastic
🏔️ A functional web framework that streamlines explicit development practices while eliminating global state.
Stars: ✭ 131 (-40.45%)
Mutual labels:  middleware, web-framework
Giraffe
Giraffe is an F# micro web framework for building rich web applications. It has been heavily inspired and is similar to Suave, but has been specifically designed with ASP.NET Core in mind and can be plugged into the ASP.NET Core pipeline via middleware. Giraffe applications are composed of so called HttpHandler functions which can be thought of a mixture of Suave's WebParts and ASP.NET Core's middleware.
Stars: ✭ 1,703 (+674.09%)
Mutual labels:  middleware, web-framework
Thunks
A small and magical composer for all JavaScript asynchronous.
Stars: ✭ 523 (+137.73%)
Mutual labels:  async-await, generator
Sinn
a blog based on of react,webpack3,dva,redux,material-ui,fetch,generator,markdown,nodejs,koa2,mongoose,docker,shell,and async/await 基于react+koa2技术栈的个人开源博客系统
Stars: ✭ 175 (-20.45%)
Mutual labels:  async-await, generator
Faygo
Faygo is a fast and concise Go Web framework that can be used to develop high-performance web app(especially API) with fewer codes. Just define a struct handler, faygo will automatically bind/verify the request parameters and generate the online API doc.
Stars: ✭ 1,557 (+607.73%)
Mutual labels:  middleware, web-framework
Webgo
A minimal framework to build web apps; with handler chaining, middleware support; and most of all standard library compliant HTTP handlers(i.e. http.HandlerFunc).
Stars: ✭ 165 (-25%)
Mutual labels:  middleware, web-framework
Ego
Ego is a full-stack web framework written in Go, lightweight and efficient front-end component solutions, based on gin. The front-end is compiled, does not affect the back-end.
Stars: ✭ 185 (-15.91%)
Mutual labels:  middleware, web-framework
Vue Generate Component
Vue js component generator
Stars: ✭ 206 (-6.36%)
Mutual labels:  generator
Generators
API Generator - instantly generate REST and GraphQL APIs (openapi (OAS) 3.0.0)
Stars: ✭ 213 (-3.18%)
Mutual labels:  generator
Expo
An open-source platform for making universal native apps with React. Expo runs on Android, iOS, and the web.
Stars: ✭ 15,550 (+6968.18%)
Mutual labels:  web-framework
Regressor
Generate specs for your rails application the easy way. Regressor generates model and controller specs based on validations, associations, enums, database, routes, callbacks. Use regressor to capture your rails application behaviour.
Stars: ✭ 204 (-7.27%)
Mutual labels:  generator
Co Mocha
Enable support for generators in Mocha tests
Stars: ✭ 216 (-1.82%)
Mutual labels:  generator

Toa

简洁而强大的 web 框架。

Toa

NPM version Build Status js-standard-style Coverage Status Downloads

Thanks to Koa and it's authors

Demo

const ilog = require('ilog')
const Toa = require('toa')

const app = new Toa()

app.use(function () {
  this.body = 'support sync function middleware!\n'
})

app.use(function (next) {
  this.body += 'support thunk function middleware!\n'
  next()
})

app.use(function * () {
  this.body += yield Promise.resolve('support generator function middleware!\n')
})
// support in Node.js v8
app.use(async function () {
  this.body += await Promise.resolve('support async/await function middleware!\n')
})

app.listen(3000, () => ilog.info('App start at: 3000'))

TypeScript Demo

import { Toa } from 'toa'

const app = new Toa()

app.use(function () {
  this.body = 'support sync function middleware!\n'
})

app.use(function (next) {
  this.body += 'support thunk function middleware!\n'
  next()
})

app.use(function * () {
  this.body += yield Promise.resolve('support generator function middleware!\n')
})

app.use(async function () {
  this.body += await Promise.resolve('support async/await function middleware!\n')
})

app.listen(3000, () => console.log('App start at 3000'))

With HTTP/2

// Visit: https://127.0.0.1:3000/
const http2 = require('http2')
const fs = require('fs')
const Toa = require('toa')
const server = http2.createSecureServer({
  key: fs.readFileSync('./localhost.key'),
  cert: fs.readFileSync('./localhost.crt')
})

const app = new Toa(server)
app.use(function () {
  this.body = 'Hello World!\n-- toa'
})

app.listen(3000, () => console.log('https://127.0.0.1:3000/'))

Install

npm install toa

Toa 简介

ToaKoa 的改进版。

Toa 修改自 Koa,基本架构原理与 Koa 相似,contextrequestresponse 三大基础对象几乎一样。但 Toa 是基于 thunks 组合业务逻辑,来实现异步流程控制和异常处理。

Toa 的异步核心是 thunk 函数,支持 node.js v0.10.x,但在支持 generator 的 node 环境中(io.js, node.js >= v0.11.9)将会有更好地编程体验:用同步逻辑编写非阻塞的异步程序

ToaKoa 学习成本和编程体验是一致的,两者之间几乎是无缝切换。但 Toa 去掉了 Koa级联(Cascading) 逻辑,强化中间件,强化模块化组件,尽量削弱第三方组件访问应用的能力,使得编写大型应用的结构逻辑更简洁明了,也更安全。

koa Process

koa Process

Toa Process

Toa Process

功能模块

与 Koa 一样, Toa 也没有绑定多余的功能,而仅仅提供了一个轻量优雅的函数库,异步控制处理器和强大的扩展能力。

使用者可以根据自己的需求选择独立的功能模块或中间件,或自己实现相关功能模块。以下是 Toajs 提供的基础性的功能模块。它们已能满足大多数的应用需求。


Bench

API

使用手册

Application

Context

Request

Response

Change Log

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].