{"id":15069854,"url":"https://github.com/groupon/quinn","last_synced_at":"2025-04-10T16:53:28.847Z","repository":{"id":17626438,"uuid":"20430680","full_name":"groupon/quinn","owner":"groupon","description":"A set of convenient helpers to use promises to handle http requests","archived":false,"fork":false,"pushed_at":"2023-01-07T23:45:46.000Z","size":717,"stargazers_count":40,"open_issues_count":7,"forks_count":3,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-04-14T18:24:09.465Z","etag":null,"topics":["javascript","nodejs","quinn","web-framework"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/groupon.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-06-03T05:22:59.000Z","updated_at":"2021-06-04T14:26:25.000Z","dependencies_parsed_at":"2022-09-26T21:31:46.609Z","dependency_job_id":null,"html_url":"https://github.com/groupon/quinn","commit_stats":null,"previous_names":["jkrems/quinn2"],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/groupon%2Fquinn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/groupon%2Fquinn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/groupon%2Fquinn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/groupon%2Fquinn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/groupon","download_url":"https://codeload.github.com/groupon/quinn/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248256819,"owners_count":21073600,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","nodejs","quinn","web-framework"],"created_at":"2024-09-25T01:45:10.454Z","updated_at":"2025-04-10T16:53:28.814Z","avatar_url":"https://github.com/groupon.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![nlm-github](https://img.shields.io/badge/github-groupon%2Fquinn%2Fissues-F4D03F?logo=github\u0026logoColor=white)](https://github.com/groupon/quinn/issues)\n![nlm-node](https://img.shields.io/badge/node-%3E%3D8.3-blue?logo=node.js\u0026logoColor=white)\n![nlm-version](https://img.shields.io/badge/version-3.3.9-blue?logo=version\u0026logoColor=white)\n# Quinn\n\nA web framework designed for things to come.\u003csup\u003e[1]\u003c/sup\u003e\n\n```js\nimport { createServer } from 'http';\nimport { createApp, respond } from 'quinn';\n\nconst app = createApp(req =\u003e respond({ body: 'Hello World!' }));\n\ncreateServer(app).listen(3000);\n```\n\n## Concepts\n\n### Request handler\n\nA potentially async function that takes a request and returns a response.\n\n```js\nfunction handler(request) {\n  return result;\n}\n```\n\n#### `Request`\n\nAn [`http.IncomingMessage`](https://iojs.org/api/http.html#http_http_incomingmessage).\nThere are no additional properties or magical extension methods.\n\n#### `DispatchResult`\n\nEither a `VirtualResponse`\u003csup\u003e[2]\u003c/sup\u003e or `undefined`.\nIf it's `undefined`, the handler was unable to handle the given request.\nE.g. the handler implements routing logic and no route matched the given url.\n\n#### `respond`\n\nThe `respond` function is the primary means to create `VirtualResponse` instances.\nIt takes one of three possible values:\n\n* An existing `VirtualResponse` instance that will be returned unchanged.\n  This ensures that calling `respond` multiple times is idempotent.\n* A response body (see below).\n* An object with any combination of numeric `statusCode`,\n  `headers` object, and/or a `body` property.\n\nThe `body` can be one of the following:\n\n* A buffer or `Uint8Array`.\n* A string.\n* A readable stream.\n* An empty body can be expressed by passing `null`.\n* A function that takes a request and a response and returns one of the previous types.\n  This variant is called a \"lazy body\" and can be used to delay serialization\n  or returns bodies that depend on the incoming request as with JSONP responses.\n\n#### `VirtualResponse`\n\nA pass-through stream describing the response that should be returned.\nWhile it might have additional utility functions,\nonly the following properties and methods should be relied on:\n\n* [`response.setHeader(name, value)`](https://iojs.org/api/http.html#http_response_setheader_name_value)\n* [`response.getHeader(name)`](https://iojs.org/api/http.html#http_response_getheader_name)\n* [`response.removeHeader(name)`](https://iojs.org/api/http.html#http_response_removeheader_name)\n* [`response.statusCode`](https://iojs.org/api/http.html#http_response_statuscode)\n* [`response.write(chunk[, encoding][, callback])`](https://iojs.org/api/http.html#http_response_write_chunk_encoding_callback)\n* [`response.end([data][, encoding][, callback])`](https://iojs.org/api/http.html#http_response_end_data_encoding_callback)\n\nThe behavior of each should match [`ServerResponse`](https://iojs.org/api/http.html#http_class_http_serverresponse).\nAll headers and the status code should be forwarded\nwhen the response is piped to a target.\nThe `statusCode` by setting the property,\nthe headers by calls to `setHeader` on the target, one header at a time.\n\nA `VirtualResponse` can either be piped to a target stream\nor forwarded using `response.forwardTo(req, res)`.\nLazy bodies are only supported when using `forwardTo`.\nWhen using `forwardTo`, it will return a promise\nthat resolves once the response has been successfully written.\n\n## Combining Quinn\n\n### With Express\n\n```js\nimport express from 'express';\nimport { createApp as quinn, respond } from 'quinn/express';\n\nconst app = express();\napp.get('/quinn-route', quinn(req =\u003e respond({ body: 'Hello World!' })));\n```\n\n## References\n\n### Similar Libraries\n\nMost of these are based on JSGI.\nWhich would make sense if node wouldn't include an http server.\n\n* [mikeal/response](https://github.com/mikeal/response)\n* [q-io](http://documentup.com/kriskowal/q-io#http-applications)\n* [bogart](https://github.com/nrstott/bogart)\n* [mach](https://github.com/mjackson/mach)\n\n-----\n\n\u003csup\u003e[1]\u003c/sup\u003e In other words: an experimental mess.\n\n\u003csup\u003e[2]\u003c/sup\u003e Because buzz word.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgroupon%2Fquinn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgroupon%2Fquinn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgroupon%2Fquinn/lists"}