https://github.com/simplesmiler/taxios
Typed wrapper over axios
https://github.com/simplesmiler/taxios
Last synced: over 1 year ago
JSON representation
Typed wrapper over axios
- Host: GitHub
- URL: https://github.com/simplesmiler/taxios
- Owner: simplesmiler
- Created: 2020-07-20T16:57:35.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-11-14T13:01:47.000Z (over 2 years ago)
- Last Synced: 2024-03-14T18:18:36.522Z (over 2 years ago)
- Language: TypeScript
- Size: 1.21 MB
- Stars: 13
- Watchers: 3
- Forks: 3
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# `taxios`
> TypeScript wrapper over Axios.
## Use
Install packages.
```sh
npm i axios @simplesmiler/taxios
npm i -D @simplesmiler/taxios-generate
```
Generate typings with [@simplesmiler/taxios-generate](https://github.com/simplesmiler/taxios/tree/master/packages/taxios-generate).
```sh
npx taxios-generate -o PetStore.ts -e PetStore https://petstore.swagger.io/v2/swagger.json
```
Use typings with [@simplesmiler/taxios](https://github.com/simplesmiler/taxios/tree/master/packages/taxios).
```ts
import axios from 'axios';
import { Taxios } from '@simplesmiler/taxios';
// Import generated typings
import { PetStore } from './PetStore';
// Create axios client and taxios wrapper
const taxios = new Taxios(axios.create({ baseURL: 'https://petstore.swagger.io/v2' }));
// Make request
const pet = await taxios.get('/pet/{petId}', { params: { petId: 1 } });
```
## Develop
1. Clone repo
2. `npm ci`
3. Change something in `taxios` or `taxios-generate` package
4. Test by running scripts in `taxios-sandbox` package
## Publish
1. `npm run build`
2. `npm run publish`