{"id":18822790,"url":"https://github.com/varthanv/express-header-middleware","last_synced_at":"2026-05-10T06:37:47.078Z","repository":{"id":135943520,"uuid":"603285191","full_name":"VarthanV/express-header-middleware","owner":"VarthanV","description":"A middleware for express js to validate your  headers and abort the request with response when the criteria for the headers is not satisifed","archived":false,"fork":false,"pushed_at":"2023-02-18T06:09:00.000Z","size":119,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-30T04:18:07.907Z","etag":null,"topics":["backend","expressjs","middleware"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/express-header-middleware","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/VarthanV.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2023-02-18T03:17:20.000Z","updated_at":"2023-06-06T01:59:40.000Z","dependencies_parsed_at":null,"dependency_job_id":"807b41b8-e859-497d-931f-e8f276adeeba","html_url":"https://github.com/VarthanV/express-header-middleware","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VarthanV%2Fexpress-header-middleware","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VarthanV%2Fexpress-header-middleware/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VarthanV%2Fexpress-header-middleware/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VarthanV%2Fexpress-header-middleware/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/VarthanV","download_url":"https://codeload.github.com/VarthanV/express-header-middleware/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239758890,"owners_count":19692041,"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":["backend","expressjs","middleware"],"created_at":"2024-11-08T00:51:35.605Z","updated_at":"2026-01-19T04:30:15.397Z","avatar_url":"https://github.com/VarthanV.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# express-header-middleware \n\nA middleware for express js to validate your headers and abort the request with response when the criteria for the headers is not satisifed\n\n## Installation\n\n```sh\n    npm i express-header-middleware --save\n```\n\n## Usage\n\n```js\n\nimport express, { Express } from \"express\";\n\nconst app: Express = express();\n\napp.use(\n  headerMiddleware({\n    headers: [\n      {\n        name: \"foo\",\n        errorCode:\"FOO\",\n        httpStatusCode:403, // optional, Default 400\n        regExp:new RegExp(\"\\\\w+\") // optional \n\n      },\n\n    ],\n  })\n);\n\napp.get(\"/\", (req, res) =\u003e {\n  res.send(\"fooo\");\n  return;\n});\n\napp.listen(3000, () =\u003e {\n  console.log(`⚡️[server]: Server is running at http://localhost:3000`);\n});\n\n```\n\n## Empty Case\n\n```json\n{\n  \"error\": \"foo is required\",\n  \"errorCode\": \"FOO\"\n}\n```\n\n## Regex pattern is not matched\n\n```json\n{\n    \"error\": \"foo does'nt match the regex pattern /\\\\d+/\",\n    \"errorCode\": \"FOO\"\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvarthanv%2Fexpress-header-middleware","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvarthanv%2Fexpress-header-middleware","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvarthanv%2Fexpress-header-middleware/lists"}