{"id":24612660,"url":"https://github.com/josemucv2/fetchify","last_synced_at":"2026-04-16T05:02:17.570Z","repository":{"id":269337334,"uuid":"907095737","full_name":"josemucv2/Fetchify","owner":"josemucv2","description":"Fetchify is a lightweight and flexible library for making HTTP requests in JavaScript/TypeScript applications. It allows managing custom configurations, token authentication, and supports request and response interceptors. Compatible on both client and server.","archived":false,"fork":false,"pushed_at":"2025-01-08T20:35:43.000Z","size":161,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-24T20:27:08.717Z","etag":null,"topics":["angular","api","https","library","nodejs","react","svelte","typescript","vue"],"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/josemucv2.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":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-22T19:49:47.000Z","updated_at":"2025-01-08T20:35:47.000Z","dependencies_parsed_at":"2024-12-22T21:19:37.226Z","dependency_job_id":"74e9c35e-c4d2-4171-ba46-37e5ff417f6a","html_url":"https://github.com/josemucv2/Fetchify","commit_stats":null,"previous_names":["josemucv2/fetchify"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/josemucv2%2FFetchify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/josemucv2%2FFetchify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/josemucv2%2FFetchify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/josemucv2%2FFetchify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/josemucv2","download_url":"https://codeload.github.com/josemucv2/Fetchify/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244259587,"owners_count":20424573,"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":["angular","api","https","library","nodejs","react","svelte","typescript","vue"],"created_at":"2025-01-24T20:23:55.094Z","updated_at":"2026-04-16T05:02:17.476Z","avatar_url":"https://github.com/josemucv2.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @jmfetchify/fetchify\n\n**@jmfetchify/fetchify** is a lightweight and flexible HTTP request library for JavaScript/TypeScript applications. It provides simple configuration management, token-based authentication, and supports request and response interceptors. It works seamlessly on both client and server sides.\n\n## Features\n\n- Customizable HTTP request methods (GET, POST, PUT, PATCH, DELETE).\n- Token management for authentication.\n- Request and response interceptors.\n- Supports both client-side (browser) and server-side (Node.js) usage.\n\n## Installation\n\nTo install the library, run:\n\n```bash\nnpm install @jmfetchify/fetchify\n```\nor\n```bash\npnpm install @jmfetchify/fetchify\n```\n\n## USAGE\n\n```typescript\n\nimport { Fetchify } from \"@jmfetchify/fetchify\";\n\nconst fetchifyInstance = Fetchify.create({\n    baseURL: 'https://your-api-url.com',\n    headers: {}\n});\n\nfetchifyInstance.setToken({ token: 'your-auth-token' });\n\nfetchifyInstance.setRequestInterceptor(async (config) =\u003e {\n\n    const token = localStorage.getItem(\"accessToken\");\n\n    if (token) {\n        config.headers.set(\"Authorization\", `Bearer ${token}`);\n    }\n\n    console.log(\"Request Interceptor:\", config);\n\n    return config;\n});\n\n// Example GET request\nfetchifyInstance.GET({ endpoint: 'users' }).then(response =\u003e {\n\n    console.log('Users:', response);\n\n}).catch(error =\u003e {\n\n    console.error('Error fetching users:', error);\n\n});\n```\n\n## API Methods\n\n### setToken\nSets the authentication token for the requests.\n\n```typescript\nsetToken({ token: string })\n```\n\n### `setRequestInterceptor`\nSets a request interceptor to modify the request before it is sent.\n\n```typescript\nsetRequestInterceptor(interceptor: (config: Request) =\u003e Promise\u003cRequest\u003e)\n```\n\n### setResponseInterceptor\nSets a response interceptor to modify the response before it is returned to the caller.\n```typescript\nsetResponseInterceptor(interceptor: \u003cT\u003e(response: T) =\u003e Promise\u003cT\u003e)\n```\n\n### GET\nSends a GET request to the specified endpoint.\n```typescript\nGET\u003cT\u003e({ endpoint: string, options?: RequestInit, timeOut?: number })\n```\n\n### POST\nSends a POST request to the specified endpoint with the given body.\n```typescript\nPOST\u003cT\u003e({ endpoint: string, body?: unknown, options?: RequestInit, timeOut?: number })\n```\n\n### PUT\nSends a PUT request to the specified endpoint with the given body.\n\n```typescript\nPUT\u003cT\u003e({ endpoint: string, body?: unknown, options?: RequestInit, timeOut?: number })\n```\n\n### PATCH\nSends a PATCH request to the specified endpoint with the given body.\n```typescript\nPATCH\u003cT\u003e({ endpoint: string, body?: unknown, options?: RequestInit, timeOut?: number })\n```\n\n### DELETE\nSends a DELETE request to the specified endpoint.\n```typescript\nDELETE\u003cT\u003e({ endpoint: string, options?: RequestInit, timeOut?: number })\n```\n## License\nThis project is licensed under the MIT License. See the [LICENSE](./LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjosemucv2%2Ffetchify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjosemucv2%2Ffetchify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjosemucv2%2Ffetchify/lists"}