{"id":34924508,"url":"https://github.com/sckv/barehttp","last_synced_at":"2026-03-18T00:43:19.987Z","repository":{"id":40499561,"uuid":"365612909","full_name":"sckv/barehttp","owner":"sckv","description":"Minimalistic, lightweight, and fast cloud-oriented Node.js webserver to perform as Microservice or BFF proxy.","archived":false,"fork":false,"pushed_at":"2024-01-26T20:11:15.000Z","size":1951,"stargazers_count":5,"open_issues_count":5,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-12T03:41:13.481Z","etag":null,"topics":["cloud","http","http-server","lightweight","microservices","middleware","nodejs","server","webserver"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sckv.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-05-08T21:17:47.000Z","updated_at":"2023-03-14T21:32:38.000Z","dependencies_parsed_at":"2024-06-21T15:35:48.640Z","dependency_job_id":"ff53ad36-5844-497c-82a3-bc77cd0c0bc7","html_url":"https://github.com/sckv/barehttp","commit_stats":{"total_commits":102,"total_committers":5,"mean_commits":20.4,"dds":0.06862745098039214,"last_synced_commit":"92de54286d92d2b0c9731ab8d3d411f485458fed"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/sckv/barehttp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sckv%2Fbarehttp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sckv%2Fbarehttp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sckv%2Fbarehttp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sckv%2Fbarehttp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sckv","download_url":"https://codeload.github.com/sckv/barehttp/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sckv%2Fbarehttp/sbom","scorecard":{"id":804997,"data":{"date":"2025-08-11","repo":{"name":"github.com/sckv/barehttp","commit":"92de54286d92d2b0c9731ab8d3d411f485458fed"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.8,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 0/6 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/release.yml:1","Warn: no topLevel permission defined: .github/workflows/test_branch.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/sckv/barehttp/release.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/sckv/barehttp/release.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test_branch.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/sckv/barehttp/test_branch.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test_branch.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/sckv/barehttp/test_branch.yml/master?enable=pin","Info:   0 out of   4 GitHub-owned GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 27 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"42 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-h5c3-5r3r-rr8q","Warn: Project is vulnerable to: GHSA-rmvr-2pp2-xj38","Warn: Project is vulnerable to: GHSA-xx4v-prfh-6cgc","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-wf5p-g6vw-rhxx","Warn: Project is vulnerable to: GHSA-jr5f-v2jv-69x6","Warn: Project is vulnerable to: GHSA-qwcr-r2fm-qrc7","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x","Warn: Project is vulnerable to: GHSA-h452-7996-h45h","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-rv95-896h-c2vc","Warn: Project is vulnerable to: GHSA-qw6h-vgh9-j6wx","Warn: Project is vulnerable to: GHSA-3fjj-p79j-c9hh","Warn: Project is vulnerable to: GHSA-rrr8-f88r-h8q6","Warn: Project is vulnerable to: GHSA-jchw-25xp-jwwc","Warn: Project is vulnerable to: GHSA-cxjh-pqwp-8mfp","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-rc47-6667-2j5j","Warn: Project is vulnerable to: GHSA-78xj-cgh5-2h22","Warn: Project is vulnerable to: GHSA-2p57-rm9w-gvfp","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-5v2h-r2cx-5xgj","Warn: Project is vulnerable to: GHSA-rrrm-qjm4-v8hf","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-hj9c-8jmm-8c52","Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j","Warn: Project is vulnerable to: GHSA-rhx6-c78j-4q9w","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-x2pg-mjhr-2m5x","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-4x5v-gmq8-25ch","Warn: Project is vulnerable to: GHSA-m6fv-jmcg-4jfg","Warn: Project is vulnerable to: GHSA-cm22-4g7w-348p","Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-23T11:32:43.469Z","repository_id":40499561,"created_at":"2025-08-23T11:32:43.469Z","updated_at":"2025-08-23T11:32:43.469Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28055967,"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","status":"online","status_checked_at":"2025-12-26T02:00:06.189Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["cloud","http","http-server","lightweight","microservices","middleware","nodejs","server","webserver"],"created_at":"2025-12-26T14:18:08.235Z","updated_at":"2025-12-26T14:18:09.934Z","avatar_url":"https://github.com/sckv.png","language":"TypeScript","readme":"# barehttp\n\nFull-featured slim webserver for microservices with extremely low overhead and ready for production\n\n[![Known Vulnerabilities](https://snyk.io/test/github/sckv/bare-http/badge.svg)](https://snyk.io/test/github/sckv/bare-http)\n\n## Table of Contents\n\n- [Requirements](#Requirements)\n- [Quick start](#Quick-start)\n- [Usage](#Usage)\n- [API](#API)\n- [Features](#Features)\n- [Support](#Support)\n\n## Requirements\n\n```bash\nNode.js \u003e= 22\n```\n\n## Quick start\n\nCreate directory\n\n```bash\nmkdir backend-application\ncd backend-application\n```\n\nInstall the service\n\nnpm\n\n```bash\nnpm i barehttp --save\n```\n\nyarn\n\n```bash\nyarn add barehttp\n```\n\n## Usage\n\n### Basic\n\n```typescript\nimport { BareHttp, logMe } from 'barehttp';\n\nconst app = new BareHttp();\n\napp.route.get({\n  route: '/route',\n  handler: function routeGet(flow) {\n    flow.json({ everything: 'OK' });\n  })\n});\n\n\n// you can chain the routes\napp.route\n  .post({\n    route: '/route',\n    handler: async function routePost(flow) {\n      return 'RESPONSE POST';\n    },\n  })\n  .route.patch({\n    route: '/route',\n    handler: async function routePatch(flow) {\n      return 'RESPONSE PATCH';\n  })\n\n// Define a middleware\napp.use((flow) =\u003e {\n  logMe.info('my middleware');\n});\n\napp.start((address) =\u003e {\n  console.log(`BareServer started at ${address}`);\n});\n```\n\n### async-await\n\n```typescript\nimport { BareHttp, logMe } from 'barehttp';\n\nconst app = new BareHttp({ logging: true });\n\n app.route.get({\n  route:'/route',\n  handler: async function routeV1() {\n    return { promised: 'data' };\n  })\n});\n\n// Define a middleware\napp.use(async (flow) =\u003e {\n  logMe.info('my middleware');\n  await someAuthenticationFlow();\n});\n\napp.start((address) =\u003e {\n  console.log(`BareServer started at ${address}`);\n});\n```\n\n# API\n\n## `BareHttp(BareOptions)` (Class)\n\nAn instance of the application\n\n### `BareOptions` (Object)\n\nOptions submitted to the server at initialization\n\n#### `middlewares?` (Array\u003c(flow: BareRequest) =\u003e Promise\u003cvoid\u003e | void\u003e)\n\nIf provided, this will apply an array of middlewares to each incoming request.\nThe order of the array is the order of middlewares to apply\n\n#### `serverPort?` (Number)\n\nDefault `3000`\n\nListening port\n\n#### `serverAddress?` (String)\n\nDefault `'0.0.0.0'`\n\nAddress to bind the web server to\n\n#### `context?` (Boolean)\n\nDefault `false`\n\nEnables request context storage accessible through all application importing `import { context } from 'barehttp';`\n\n#### `logging?` (Boolean)\n\nDefault `false`\n\nEnable request/response logging, format varies from `production` or `development` environments, though to change use e.g. `NODE_ENV=production`\n\n#### `logger?` (Object)\n\nConfigure log outputs for app logs and http request logs.\n\n```typescript\nconst app = new BareHttp({\n  logging: true,\n  logger: {\n    app: { file: './logs/app.log' },\n    http: { file: './logs/http.log' },\n    level: 'debug',\n  },\n});\n```\n\n`app.file` and `http.file` accept a path string or `{ path, sync }`, and `http.file` is used only when `logging: true`. `console` (default `true`) keeps stdout logging, and `pretty` (default `true` outside production) controls colored console output. `level` sets the base level and can be overridden per target with `app.level` or `http.level`. Use `sourceMaps: true` to map log locations back to `.ts` files (requires source maps in your build).\n\n#### `ws?` (Boolean)\n\nDefault `false`\n\nEnable WebSocket support through `ws` package.\n\n#### `wsOptions?` (Object)\n\nRefer to [ws](https://github.com/websockets/ws) documentation.\n\n#### `errorHandlerMiddleware?` ((err: any, flow: BareRequest) =\u003e void)\n\nIf provided, will set a custom error handler to catch the bubbled errors from the handlers\n\n#### `requestTimeFormat?` (String: 's' | 'ms')\n\nDefault `'s'` - seconds\n\nRequest execution time format in `seconds` or `milliseconds`\n\n#### `cookies?` (Boolean)\n\nControl over cookies. If enabled this will turn on automatic cookies decoding, if you want to set up more settings for this (e.g. signed cookies), next option is available\n\n#### `cookiesOptions?` (CookieManagerOptions)\n\nTo set options for the cookies decoding/encoding\n\n#### `reverseDns?` (Boolean)\n\nIf enabled, and also with `logging: true`, will try to log the resolved reverse DNS of the first hop for remote ip of the client (first proxy).\nLogs follow an [Apache Common Log Format](https://httpd.apache.org/docs/2.4/logs.html)\n\n#### `statisticsReport?` (Boolean)\n\nDefault `false`\n\nExposes a basic report with the routes usage under `GET /_report` route\n\n---\n\n## `BareServer.use` ((flow: BareRequest) =\u003e Promise\u003cvoid\u003e | void)\n\nAttach a middleware `after` the middlewares optional array.\nThe order of the middlewares is followed by code declarations order.\n\n---\n\n## `BareServer.route.get | post | patch | put | delete | options | head | declare` (Function)\n\nTo set a route for `get | post | patch | put | delete | options | head` with following parameters:\n\n- `route` (String) - should follow a format of `/your_route`, including params as `/your_route/:param`\n- `options` (Object) - `RouteOptions`\n- `handler` (Function) - A function with the signature `(flow: BareRequest) =\u003e Promise\u003cany\u003e | any`\n- `method` (Array) - if the method is `declare` you have to indicate an array of methods to declare the route e.g. `['get', 'post']`\n  Example\n\n```ts\napp.route.get({\n  route: '/route',\n  options: { timeout: 2000 },\n  handler: async (flow) =\u003e {\n    return 'My route response';\n  },\n});\n\napp.route.declare({\n  route: '/declared_route',\n  handler: () =\u003e {\n    return 'My declared route response';\n  },\n  methods: ['post', 'patch'],\n});\n```\n\n## `BareServer.runtimeRoute.get | post | patch | put | delete | options | head | declare` (Function)\n\nSame as the above routes API, but you can only declare them when the server is `listening`\n\n```ts\napp.runtimeRoute\n  .get({\n    route: '/route',\n    options: { timeout: 2000 },\n    handler: async (flow) =\u003e {\n      return 'My route response';\n    },\n  })\n  .declare({\n    route: '/declared_runtime_route',\n    handler: () =\u003e {\n      return 'My declared runtime route response';\n    },\n    methods: ['post', 'patch'],\n  });\n```\n\n#### `RouteOptions` (Object)\n\nIf set, provide per-route options for behavior handling\n\n##### `disableCache?` (Boolean)\n\nDisables all cache headers for the response. This overrides any other cache setting.\n\n##### `cache?` (CacheOptions)\n\nIf set, provides a granular cache headers handling per route.\n\n##### `timeout?` (Number)\n\nRequest timeout value in `ms`. This will cancel the request _only_ for this route if time expired\n\n---\n\n## `BareServer.ws?` (WebSocketServer)\n\nBased on `ws` package, for internals please refer to [external WebSocketServer](https://github.com/websockets/ws#external-https-server) for documentation.\n\nThis particular implementation works out easily for WebSockets interaction for pushing data to server from the clients and waiting for some answer in async.\n\nAlso exposes an way to keep pushing messages to the Client from the Server on server handle through internal clients list. (WIP optimizing this)\n\n### `WebSocketServer.declareReceiver` ((Data, UserClient, WSClient, MessageEvent) =\u003e Promise\\\u003cM\u003e | M)\n\nThis is the main 'handler' function for any kind of Client request. If there's a response to that push from the client the return should contain it, otherwise if the response is `void` there will be no answer to the client side.\n\n- `Data`: is the data received from the client for this exact `Type`\n- `UserClient`: is an optional client defined on the stage of `Upgrade` to provide some closured client data to be able to know what Client is exactly making the request to the Server\n- `WSClient`: raw instance of `ws.Client \u0026 { userClient: UC }`\n- `MessageEvent`: raw instance of `ws.MessageClient`\n\nCode Example:\n\n```ts\napp.ws?.declareReceiver\u003c{ ok: string }\u003e({\n  type: 'BASE_TYPE',\n  handler: async (data, client) =\u003e {\n    // do your async or sync operations here\n    // return the response if you need to send an answer\n    return { cool: 'some answer', client };\n  },\n});\n```\n\n### `WebSocketServer.defineUpgrade` ((IncomingRequest) =\u003e Promise\\\u003cM\u003e | M)\n\nTo de able to handle authorization or any other previous operation before opening and upgrading an incoming client's request.\n**If this function is not initialized with the callback, all incoming connections will be accepted by default**\n\n```ts\napp.ws?.defineUpgrade(async (req) =\u003e {\n  // you can do some async or sync operation here\n  // the returning of this function will be\n  // defined as the `UserClient` and attached to the `ws.Client` instance\n  return { access: true, client: {...properties of the client} };\n});\n```\n\n---\n\n## `BareRequest` (Class)\n\nAn instance of the request passed through to middlewares and handlers\n\n### `cm?` (CookiesManager)\n\nAccess to the CookiesManager instance attached to the request.\n\n#### `CookiesManager` (Class)\n\nInternal methods to work with cookies\n\n##### `setCookie` (Function)\n\n##### `clearCookie` (Function)\n\n### `getHeader` (Function)\n\nGet an exact header stored to return with this request to the client\n\n### `getCookie` (Function)\n\nGet an exact client cookie of this request\n\n### `getCookies` (Function)\n\nGet all cookies of this request\n\n### `disableCache` (Function)\n\nImperatively disables cache, does the same as `disableCache: true` in `RouteOptions`\n\n### `setCache` (Function)\n\nImperatively sets the cache, does the same as `cache: CacheOptions` in `RouteOptions`\n\n### `addHeader` (Function)\n\nAdds a header outgoing header string as a (key, value) `addHeader(header, value)`. Can **not** overwrite.\n\n### `addHeaders` (Function)\n\nAdds outgoing headers in a \"batch\", merges provided headers object `{ [header: string]: value }` to already existing headers. Can **not** overwrite.\n\n### `setHeader` (Function)\n\nDoes the same as `addHeader` but overrides the value.\n\n### `setHeaders` (Function)\n\nDoes the same as `addHeaders` but overrides the value.\n\n### `status` (Function)\n\nSet a status for the response\n\n### `sendStatus` (Function)\n\nSet a status for the response and send it (end the request)\n\n### `stream` (Function)\n\nStream (pipe) a response to the client\n\n### `json` (Function)\n\nSend a JSON response to the client (will attempt to stringify safely a provided object to JSON)\n\n### `send` (Function)\n\nSend a text/buffer response to the client\n\n## Features\n\nSome of the features are in progress.\n\n- [x] Request wide context storage and incorporated tracing (ready for cloud)\n- [x] UID (adopted or generated)\n- [x] WebSocket server exposure\n- [x] handy WebSocket interaction tools, for authorization, etc.\n- [x] Request-Processing-Time header and value\n- [x] Promised or conventional middlewares\n- [x] Logging and serialized with `pino`\n- [x] Routes usage report and endpoint\n- [x] Cache headers handy handling, per route\n- [x] Cookies creation/parsing\n- [x] CORS middleware options\n- [x] Request execution cancellation by timeout\n- [x] Bulk/chaining routes declaration\n- [x] Runtime routes hot swapping\n- [x] runtime validation schema generation per route response types (on project compile/on launch)\n- [ ] middlewares per route\n- [ ] swagger OpenAPI 3.0 on `/docs` endpoint\n- [ ] swagger OpenAPI 3.0 scheme on `/docs_raw` endpoint\n- [ ] optional export of generated schema to a location (yaml, json)\n- [ ] streaming/receiving of chunked multipart\n- [ ] runtime route params or query validation upon declared types (on project compile/on launch)\n\n## Runtime schema validation on response (EXPERIMENTAL)\n\nThis feature enables a runtime check for the returned value for a route,\nfor now it only works for `return` statements of the routes declared in handlers.\n\nPlease write your `return` statements with plain response objects within the `handler` or `controller` function.\n\nTo enable this feature you need to set up the following:\n\n- On `BareHttp` settings set: `enableSchemaValidation: true`\n- On `BareHttp` settings set: `declaredRoutesPaths: [...array of paths to routes]`,\n- On `route.\u003cmethod\u003e` declaration set: `options: { builtInRuntime: { output: true } }`\n\n## Benchmarks\n\nDone on MacBook Pro with M1 Pro processor. No logs enabled. `NODE_ENV=production` is set. All settings set to default.\n\n### BareHttp\n\n![BareHttp](./docs/barehttp.png)\n\n### Express\n\n![Express](./docs/express.png)\n\n### Fastify\n\n![Fastify](./docs/fastify.png)\n\n## Support\n\nPlease open an issue if you have any questions or need support\n\n## License\n\nLicensed under [MIT](https://github.com/sckv/bare-http/blob/master/LICENSE).\n\nKonstantin Knyazev\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsckv%2Fbarehttp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsckv%2Fbarehttp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsckv%2Fbarehttp/lists"}