{"id":24113871,"url":"https://github.com/michaeljohnn/com-axios","last_synced_at":"2025-02-28T10:27:24.656Z","repository":{"id":81696942,"uuid":"179037899","full_name":"michaeljohnn/com-axios","owner":"michaeljohnn","description":"基于 axios 的请求组件封装，默认某些配置，如 xsrf 开启等","archived":false,"fork":false,"pushed_at":"2019-04-03T02:55:04.000Z","size":102,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-11T04:53:12.822Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/michaeljohnn.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":"2019-04-02T08:55:40.000Z","updated_at":"2019-04-03T02:55:05.000Z","dependencies_parsed_at":"2023-04-16T09:59:06.852Z","dependency_job_id":null,"html_url":"https://github.com/michaeljohnn/com-axios","commit_stats":null,"previous_names":["michaeljohnn/com-axios"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaeljohnn%2Fcom-axios","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaeljohnn%2Fcom-axios/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaeljohnn%2Fcom-axios/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaeljohnn%2Fcom-axios/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/michaeljohnn","download_url":"https://codeload.github.com/michaeljohnn/com-axios/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241137888,"owners_count":19916220,"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":"2025-01-11T04:50:55.571Z","updated_at":"2025-02-28T10:27:24.634Z","avatar_url":"https://github.com/michaeljohnn.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# com-axios\n通用请求组件，兼容前端和node端请求\n\n## 使用示例\n```\n\nimport comAxios from 'com-axios';\nimport apiMap from './apis';\n\n\t/**\n * api(必填项): 向后端请求的url 的一种映射，详见demo中的apis.js文件\n * data(非必填): 请求参数\n * method(非必填): 请求方式，默认为 get\n * apiMap(非必填): url映射 键值对\n * baseURL(非必填): axios 默认网址，当api为 绝对地址('http://....')时，会覆盖baseURL，不是时baseURL会添加在api前面\n */\ncomAxios({\n  api: 'test',\n  method: 'get',\n  apiMap,\n  baseURL: 'http://localhost:9000' // 此时baseURL没有用\n}).then((res) =\u003e {\n  alert(`成功返回请求值(${res})`);\n  \n  console.log(res);\n\n  this.setState({\n    res\n  })\n});\n\n```\n\n## demo 示例\n\n```\n// 启动 demo 前端示例\nnpm start\n\n// 启动 demo 后端服务\nnpm run server\n\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaeljohnn%2Fcom-axios","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmichaeljohnn%2Fcom-axios","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaeljohnn%2Fcom-axios/lists"}