{"id":13716550,"url":"https://github.com/cprecioso/micro-protocol","last_synced_at":"2025-03-24T23:35:28.115Z","repository":{"id":46933905,"uuid":"222305884","full_name":"cprecioso/micro-protocol","owner":"cprecioso","description":"Micro middleware to get the protocol of the request","archived":false,"fork":false,"pushed_at":"2023-01-05T01:03:47.000Z","size":232,"stargazers_count":0,"open_issues_count":9,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-01T13:06:07.538Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/cprecioso.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}},"created_at":"2019-11-17T20:13:52.000Z","updated_at":"2020-07-20T16:21:00.000Z","dependencies_parsed_at":"2023-02-03T03:01:18.966Z","dependency_job_id":null,"html_url":"https://github.com/cprecioso/micro-protocol","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cprecioso%2Fmicro-protocol","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cprecioso%2Fmicro-protocol/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cprecioso%2Fmicro-protocol/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cprecioso%2Fmicro-protocol/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cprecioso","download_url":"https://codeload.github.com/cprecioso/micro-protocol/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245372220,"owners_count":20604488,"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":[],"created_at":"2024-08-03T00:01:11.680Z","updated_at":"2025-03-24T23:35:28.089Z","avatar_url":"https://github.com/cprecioso.png","language":"TypeScript","funding_links":[],"categories":["Modules"],"sub_categories":["HTTP Requests"],"readme":"# `micro-protocol`\n\nAdapted the\n[`express.js` algorithm](hthttps://github.com/expressjs/express/blob/b8e50568af9c73ef1ade434e92c60d389868361d/lib/request.js#L306)\nto a [`micro`](https://github.com/zeit/micro) middleware.\n\n## Installation\n\n```sh\n$ npm install micro-protocol\n```\n\n## Example\n\n```js\nimport protocol from \"micro-protocol\"\n\nexport default protocol(\n  async (req, res) =\u003e {\n    console.log(req.protocol) // -\u003e \"http\", or \"https\"\n  {\n    trustProxy: true\n    // (Optional - default `false`) Whether to trust the X-Forwarded-Proto if\n    // you use a reverse proxy. You can also pass a function that accepts\n    // `req.connection.remoteAddress` and returns a boolean whether to trust\n    // it.\n  }\n)\n```\n\nIf you don't use a bundler or ES module, you can import like\n\n```js\nconst protocol = require(\"micro-protocol\").default\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcprecioso%2Fmicro-protocol","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcprecioso%2Fmicro-protocol","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcprecioso%2Fmicro-protocol/lists"}