{"id":18374467,"url":"https://github.com/recruit-tech/agrios","last_synced_at":"2025-04-06T19:32:39.925Z","repository":{"id":57174621,"uuid":"129994689","full_name":"recruit-tech/agrios","owner":"recruit-tech","description":":package::+1: Package your agreed server as axios adapter","archived":false,"fork":false,"pushed_at":"2020-02-16T09:15:41.000Z","size":274,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":21,"default_branch":"master","last_synced_at":"2025-03-22T06:12:46.273Z","etag":null,"topics":["agreed","ajax","axios","mock"],"latest_commit_sha":null,"homepage":"","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/recruit-tech.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":"2018-04-18T02:52:15.000Z","updated_at":"2020-02-14T12:59:33.000Z","dependencies_parsed_at":"2022-09-03T09:03:12.044Z","dependency_job_id":null,"html_url":"https://github.com/recruit-tech/agrios","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/recruit-tech%2Fagrios","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/recruit-tech%2Fagrios/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/recruit-tech%2Fagrios/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/recruit-tech%2Fagrios/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/recruit-tech","download_url":"https://codeload.github.com/recruit-tech/agrios/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247539456,"owners_count":20955312,"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":["agreed","ajax","axios","mock"],"created_at":"2024-11-06T00:14:45.941Z","updated_at":"2025-04-06T19:32:35.364Z","avatar_url":"https://github.com/recruit-tech.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# \u003cimg width=\"150\" src=\"https://recruit-tech.github.io/agrios/media/agrios-logo.svg\" /\u003e\n\n[![CircleCI](https://circleci.com/gh/recruit-tech/agrios.svg?style=svg)](https://circleci.com/gh/recruit-tech/agrios)\n[![codecov](https://codecov.io/gh/recruit-tech/agrios/branch/master/graph/badge.svg)](https://codecov.io/gh/recruit-tech/agrios)\n\n\u003e :package::+1: Package your agreed server as [axios adapter][]\n\nAgrios packages your `agree` file into [axios adapter][]. If you set it as the `adapter` of axios, then it gets responses from the `agree`s of your agreed files. See below for details.\n\n# Install\n\n    npm install --save-dev agrios\n\n# Usage\n\nFirst create adapter:\n\n```js\nconst agrees = require('./path/to/agreed-file')\nconst agrios = require('agrios')\n\nconst agreedAdapter = agrios(agrees)\n```\n\nThen set it to your axios:\n\n```js\nconst axios = require('axios')\n\naxios.default.adapter = agreedAdapter\n```\n\nThen your axios calls get responses from the agreed files.\n\n```js\naxios.get('path/to/agreed-endpoint', { params: { some_key: 'some_value' } })\n```\n\nThis doesn't make an acutual API request, but does get the response from the agreed files.\n\n# API\n\n```js\nconst agrios = require('agrios')\n```\n\n## agrios(agrees)\n\n- @param {Object[]} agrees The list of agree objects\n\nCreates the [axios adapter][] from the agreed definition array.\n\n**NOTE**: Each item in `agrees` have to be an object. Unlike `agreed-server`, the string item (path of the agree file) is not supported.\n\nIf you have agreed root file like the below:\n\n```js\nmodule.exports = [\n  './path/to/agree/foo.js',\n  './path/to/agree/bar.js',\n  './path/to/agree/baz.js',\n  './path/to/agree/qux.js'\n]\n```\n\nYou need to rewrite it to:\n\n```js\nmodule.exports = [\n  require('./path/to/agree/foo.js'),\n  require('./path/to/agree/bar.js'),\n  require('./path/to/agree/baz.js'),\n  require('./path/to/agree/qux.js')\n]\n```\n\n# License\n\nMIT\n\n[Axios adapter]: https://github.com/axios/axios/tree/master/lib/adapters\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frecruit-tech%2Fagrios","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frecruit-tech%2Fagrios","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frecruit-tech%2Fagrios/lists"}