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

koajs/koala: [SEEKING MAINTAINER] An HTTP/2 and ES6 Module-ready Koa Suite

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

开源软件名称:

koajs/koala

开源软件地址:

https://github.com/koajs/koala

开源编程语言:

JavaScript 95.5%

开源软件介绍:

Koalaα

Gitter chat NPM version Build status Test coverage Dependency Status License Downloads

A suite of Koa utilities allowing for quicker bootstrapping, as well as a consequential guide on how to write apps using the Koa philosophy. Think of it as a KrakenJS for Koa.

Status

Beware! Koala is alpha software!

Philosophy

Koa is a bare minimal framework, focusing on unopinionated core HTTP utilities. However, this is not sufficient for most apps as a lot is not supported out of the box. Including a bunch of dependencies in every new app you create quickly becomes annoying.

The goal of Koala is to include the most used and unopinionated parts of apps into a single framework. Many things such as body parsing, sessions, and CSRF are included. Many other things, such as routing, is too opinionated and not included.

Unlike other frameworks, Koala will not dictate how to write business logic. Thanks to generators and, eventually, ES7 Async/Await, writing business logic in Koa is much easier than other frameworks, and Koala's goal is to only make it easier. Don't expect a single option to automatically do magic for your app.

Feel free to create suggestions!

Features and Documentation

The Koala framework adds to Koa:

  • Body Parsing
    • Seamless Expect: 100-continue support
    • Per-request body limits
    • Supports JSON, urlencoded, and multipart bodies
    • Supports arbitrary strings, buffers, and files as bodies
    • Optional nested parameter support
  • File Serving
  • Sessions
    • Cookie-based sessions
    • CSRF protection
  • Response Caching - cache and serve responses using an arbitrary store
  • JSONP - safe jsonp support
  • Security Headers
  • Error Page - better default error page
  • Tracing
  • etc
    • Basic auth
    • Object stream support
    • Optional nested query string supported
  • FAQ

koala(1) will be a generator, similar to what express(1) is.

Usage

Simply replace require('koa') with require('koala'). Koala returns a koa app, except it includes more features.

const koala = require('koala');
const app = new Koala();

app.use(async () => {
  this.response.status = 204;
});

app.listen((err) => {
  if (err) {
    console.error(err);
    throw err;
  }
  console.log('Koala app listening on port %s', this.address().port);
});

Roadmap

Some additional features may include:

  • Timeout assertion
  • Server-Side Event Streams
  • Rate limiting

Let me know if you have any other suggestions.




鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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