quinn

A web framework designed for things to come.

Quinn

A web framework designed for things to come.[1]

import { createServer } from 'http';
import { createApp, respond } from 'quinn';
 
const app = createApp(req => respond({ body: 'Hello World!' }));
 
createServer(app).listen(3000);

A potentially async function that takes a request and returns a response.

function handler(request) {
  return result;
}

An http.IncomingMessage. There are no additional properties or magical extension methods.

Either a VirtualResponse[2] or undefined. If it's undefined, the handler was unable to handle the given request. E.g. the handler implements routing logic and no route matched the given url.

A pass-through stream describing the response that should be returned. While it might have additional utility functions, only the following properties and methods should be relied on:

The behavior of each should match ServerResponse. All headers and the status code should be forwarded when the response is piped to a target. The statusCode by setting the property, the headers by calls to setHeader on the target, one header at a time.

Quinn itself only cares that it has a pipe method which is used to forward the data to a ServerResponse.

import express from 'express';
import { createApp as quinn, respond } from 'quinn/express';
 
const app = express();
app.get('/quinn-route', quinn(req => respond({ body: 'Hello World!' })));

Most of these are based on JSGI. Which would make sense if node wouldn't include an http server.


[1] In other words: an experimental mess.

[2] Because buzz word.