nodejs(nodejs)

Koa 应用程序是一个包含一组中间件函数的对象,它是按照类似堆栈的方式组织和执行的。 Koa 类似于你可能遇到过的许多其他中间件系统,例如 Ruby 的 Rack ,Connect 等,然而,一个关键的设计点是在其低级中间件层中提供高级“语法糖”。 这提高了互操作性,稳健性,并使书写中间件更加愉快。

这包括诸如内容协商,缓存清理,代理支持和重定向等常见任务的方法。 尽管提供了相当多的有用的方法 Koa 仍保持了一个很小的体积,因为没有捆绑中间件。

必修的 hello world 应用:

————————

A koa application is an object that contains a set of middleware functions, which are organized and executed in a stack like manner. Koa is similar to many other middleware systems you may encounter, such as Ruby’s rack, connect, etc. However, a key design point is to provide high-level “syntax sugar” in its low-level middleware layer. This improves interoperability, robustness, and makes writing middleware more enjoyable.

This includes methods for common tasks such as content negotiation, cache cleanup, proxy support, and redirection. Despite providing quite a number of useful methods, KOA maintains a small volume because there is no bundled middleware.

Required Hello world applications: