{"id":13716575,"url":"https://github.com/cprecioso/micro-hostname","last_synced_at":"2025-03-24T23:35:31.174Z","repository":{"id":46933928,"uuid":"222186784","full_name":"cprecioso/micro-hostname","owner":"cprecioso","description":"Micro middleware to get the hostname of the request","archived":false,"fork":false,"pushed_at":"2023-01-05T01:01:10.000Z","size":280,"stargazers_count":0,"open_issues_count":10,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-12T17:02:12.294Z","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-17T02:31:18.000Z","updated_at":"2020-07-20T16:21:18.000Z","dependencies_parsed_at":"2023-02-03T03:01:23.246Z","dependency_job_id":null,"html_url":"https://github.com/cprecioso/micro-hostname","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cprecioso%2Fmicro-hostname","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cprecioso%2Fmicro-hostname/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cprecioso%2Fmicro-hostname/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cprecioso%2Fmicro-hostname/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cprecioso","download_url":"https://codeload.github.com/cprecioso/micro-hostname/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244470287,"owners_count":20457911,"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.957Z","updated_at":"2025-03-24T23:35:31.135Z","avatar_url":"https://github.com/cprecioso.png","language":"TypeScript","funding_links":[],"categories":["Modules"],"sub_categories":["HTTP Requests"],"readme":"# `micro-hostname`\n\nAdapted the\n[`express.js` algorithm](https://github.com/expressjs/express/blob/b8e50568af9c73ef1ade434e92c60d389868361d/lib/request.js#L427)\nto a [`micro`](https://github.com/zeit/micro) middleware.\n\n## Installation\n\n```sh\n$ npm install micro-hostname\n```\n\n## Example\n\n```js\nimport hostname from \"micro-hostname\"\n\nexport default hostname(\n  async (req, res) =\u003e {\n    console.log(req.hostname) // -\u003e \"localhost\", or \"my-deploy.now.sh\", etc\n  },\n  {\n    trustProxy: true\n    // (Optional - default `false`) Whether to trust the X-Forwarded-Host 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 hostname = require(\"micro-hostname\").default\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcprecioso%2Fmicro-hostname","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcprecioso%2Fmicro-hostname","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcprecioso%2Fmicro-hostname/lists"}