{"id":15716850,"url":"https://github.com/zurfyx/fetch-absolute","last_synced_at":"2025-03-30T20:51:26.965Z","repository":{"id":57234495,"uuid":"83211481","full_name":"zurfyx/fetch-absolute","owner":"zurfyx","description":"Fetch with default absolute URLs.","archived":false,"fork":false,"pushed_at":"2017-02-26T13:44:09.000Z","size":3,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-07T10:39:00.460Z","etag":null,"topics":["absolute","fetch","node-fetch","url"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/zurfyx.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}},"created_at":"2017-02-26T13:43:47.000Z","updated_at":"2022-11-19T00:39:44.000Z","dependencies_parsed_at":"2022-09-14T12:20:16.574Z","dependency_job_id":null,"html_url":"https://github.com/zurfyx/fetch-absolute","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zurfyx%2Ffetch-absolute","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zurfyx%2Ffetch-absolute/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zurfyx%2Ffetch-absolute/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zurfyx%2Ffetch-absolute/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zurfyx","download_url":"https://codeload.github.com/zurfyx/fetch-absolute/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246379385,"owners_count":20767696,"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":["absolute","fetch","node-fetch","url"],"created_at":"2024-10-03T21:47:27.444Z","updated_at":"2025-03-30T20:51:26.943Z","avatar_url":"https://github.com/zurfyx.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Fetch Absolute\n\n\u003e Fetch with default absolute URLs.\n\n[![Build Status](https://travis-ci.org/zurfyx/fetch-absolute.svg?branch=master)](https://travis-ci.org/zurfyx/fetch-absolute)\n[![npm version](https://badge.fury.io/js/fetch-absolute.svg)](https://badge.fury.io/js/fetch-absolute)\n\nTired of writing `http://localhost` in front of every [fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) request?\nWith fetch absolute you'll only write it once per host in your whole environment.\n\nIt works with both [window.fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) and [node-fetch](https://www.npmjs.com/package/node-fetch).\n\n## Install\n\n```\nnpm install fetch-absolute\n```\n\n## Usage\n\n```\nvar fetch = require('node-fetch');\nvar fetchAbsolute = require('fetch-absolute');\n\nglobal.fetchApi = fetchAbsolute(fetch)('http://localhost:3030');\n```\n\n## Example\n\nUsing node-fetch and fetch-absolute with Node 7 async/await:\n\n```\nconst fetch = require('node-fetch');\nconst fetchAbsolute = require('fetch-absolute');\n\nconst fetchApi = fetchAbsolute(fetch)('http://localhost:3030');\n\nit('should should display \"It works!\"', async () =\u003e {\n  const response = await fetchApi('/');\n  const json = await response.json();\n  expect(json).to.eql({ msg: 'It works!' });\n});\n```\n\nRequested absolute URLs must start with `/`, otherwise they will be treated as relative.\n\n## Related\n\n- [superagent-absolute](https://github.com/zurfyx/superagent-absolute) - Superagent with default absolute URLs.\n\n## License\n\nMIT © [Gerard Rovira Sánchez](//zurfyx.com)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzurfyx%2Ffetch-absolute","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzurfyx%2Ffetch-absolute","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzurfyx%2Ffetch-absolute/lists"}