All Projects → groupon → quinn

groupon / quinn

Licence: BSD-3-Clause license
A set of convenient helpers to use promises to handle http requests

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to quinn

geronimo-specs
Mirror of Apache Geronimo specs
Stars: ✭ 20 (-50%)
Mutual labels:  web-framework
Polyel-Framework
⚡️ Voltis Core: A PHP framework based on Swoole from the ground up
Stars: ✭ 22 (-45%)
Mutual labels:  web-framework
alef-component
Alef Component for Modern Web Apps.
Stars: ✭ 46 (+15%)
Mutual labels:  web-framework
fn
A functional web framework
Stars: ✭ 34 (-15%)
Mutual labels:  web-framework
mif
MIF is a C++11 web-application framework designed for the backend micro-service development
Stars: ✭ 42 (+5%)
Mutual labels:  web-framework
ult
The Ultimate Dev Stack
Stars: ✭ 54 (+35%)
Mutual labels:  web-framework
ninglex
Easy to learn, quick and dirty, bare-bones web framework for Common Lisp
Stars: ✭ 31 (-22.5%)
Mutual labels:  web-framework
jflask
Flask-inspired web micro-framework for Java (deprecated)
Stars: ✭ 18 (-55%)
Mutual labels:  web-framework
stirfry
StirFry is a self contained and lightweight web framework for nodejs
Stars: ✭ 24 (-40%)
Mutual labels:  web-framework
endpoints
Lightweight REST api backend framework that automatically maps urls to python modules and classes
Stars: ✭ 30 (-25%)
Mutual labels:  web-framework
Fuga-Framework
Web Framework for Java
Stars: ✭ 15 (-62.5%)
Mutual labels:  web-framework
bay
The framework
Stars: ✭ 20 (-50%)
Mutual labels:  web-framework
recurse
Qt based micro web framework with middleware design
Stars: ✭ 19 (-52.5%)
Mutual labels:  web-framework
cmd
Command line tools for Revel.
Stars: ✭ 63 (+57.5%)
Mutual labels:  web-framework
jimhttp
A library collection and web microframework
Stars: ✭ 25 (-37.5%)
Mutual labels:  web-framework
Simplify.Web
Moved to https://github.com/SimplifyNet. Simplify.Web is a lightweight and fast server-side .NET web-framework based on MVC and OWIN for building HTTP based web-applications, RESTful APIs etc.
Stars: ✭ 23 (-42.5%)
Mutual labels:  web-framework
koa
A golang framework like koa.js and has the best performance with net/http.
Stars: ✭ 30 (-25%)
Mutual labels:  web-framework
skinny-micro
🎤 Micro Web framework to build Servlet applications in Scala, the core part of Skinny Framework 2
Stars: ✭ 57 (+42.5%)
Mutual labels:  web-framework
framework
The Peak Framework
Stars: ✭ 20 (-50%)
Mutual labels:  web-framework
ncms
Java CMS engine. Host and develop multiple websites inside a single instance through the GUI and benefit from features like A/B testing, affiliate tracking tools, and a high performance template engine with CSS stylesheets processing & scripts minification.
Stars: ✭ 32 (-20%)
Mutual labels:  web-framework

nlm-github nlm-node nlm-version

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);

Concepts

Request handler

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

function handler(request) {
  return result;
}

Request

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

DispatchResult

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.

respond

The respond function is the primary means to create VirtualResponse instances. It takes one of three possible values:

  • An existing VirtualResponse instance that will be returned unchanged. This ensures that calling respond multiple times is idempotent.
  • A response body (see below).
  • An object with any combination of numeric statusCode, headers object, and/or a body property.

The body can be one of the following:

  • A buffer or Uint8Array.
  • A string.
  • A readable stream.
  • An empty body can be expressed by passing null.
  • A function that takes a request and a response and returns one of the previous types. This variant is called a "lazy body" and can be used to delay serialization or returns bodies that depend on the incoming request as with JSONP responses.

VirtualResponse

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.

A VirtualResponse can either be piped to a target stream or forwarded using response.forwardTo(req, res). Lazy bodies are only supported when using forwardTo. When using forwardTo, it will return a promise that resolves once the response has been successfully written.

Combining Quinn

With Express

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!' })));

References

Similar Libraries

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.

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].