@medley/medley v0.13.0
Medley
Medley is a fast and modern web framework for Node.js. It fully supports both async/await and
callbacks and is compatible with Node 6 or greater. It's design incorporates concepts found in
Express, Koa,
hapi, and Fastify.
Most importantly, Medley aims to provide an API that is forward-compatible with future versions
that will take full advantage of Node's HTTP/2 module.
Usage
Install:
npm install @medley/medley --saveCreate a web server:
const medley = require('@medley/medley')
const app = medley()
app.get('/', (req, res) => {
res.send('Hello World')
})
app.listen(3000)Documentation
- Getting Started
- The
medley()function - The
appObject - Routing
- The
reqObject - The
resObject - The Request Lifecyle
- Hooks
- Extensions
- JSON Serialization
- Plugins
Features
- An API similar to Express
- Performance on par with Fastify
- Full support for both
async/awaitand callbacks - Automatic
HEAD,OPTIONS, and405responses - Facilities for safely extending the framework (extensions)
- 100% test coverage
- HTTP/2 support
Forward-Compatibility with the http2 Module
HTTP/2 is the future of the web. It is faster than HTTP/1.x and comes with new, speed-boosting
features such as server push.
The Node.js http2 module has a very different API from the http/https modules, but it also provides a
compatibility API. Medley currently
uses the compatibility API (to support both HTTP/1.x and HTTP/2), but Medley's API is designed such
that when Medley upgrades to the full http2 API, application code built on Medley should not need
to change. Medley's goal is to insulate application code from this transition (as much as possible)
so that code written now that won't require massive rewrites in the future.
Ecosystem
Body Parsing
@medley/body-parser- Essential body parsers for Medley.@medley/multipart- Plugin for parsingmultipart/form-databodies.
Plugins
@medley/cookie- Plugin for parsing and setting cookies.@medley/etag- Plugin for automatic ETag generation & conditional GET responses.@medley/self-request- Plugin that augments an app to be able to make HTTP requests to itself for testing.@medley/serve-favicon- Plugin for serving the default favicon.@medley/serve-static- Plugin for serving static files.
Validation
ajv-request-validator- Tool for validating therequestobject of popular frameworks with Ajv.
Acknowledgements
This project was forked from Fastify. The initial commit is a clone of fastify/fastify@dab20bd. All of the credit for that work goes to the Fastify team.