diff --git a/README.md b/README.md index 221c613..54ab0f6 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,12 @@ Simple, typed wrapper of an Axios instance for Nextcloud that automatically send ## Installation +```sh +npm install @nextcloud/axios --save ``` -npm i -S @nextcloud/axios + +```sh +yarn add @nextcloud/axios ``` ## Usage @@ -20,3 +24,21 @@ axios.get('nextcloud.com') ``` See https://github.com/axios/axios for details. + +### Defining `baseURL` + +You are able to define [`baseURL`](https://axios-http.com/docs/config_defaults) to simplify the usage of axios across your app. + +```ts +import axios from '@nextcloud/axios' +import { generateUrl } from '@nextcloud/router' + +const baseURL = generateUrl('/apps/your_app_id/api') + +axios.defaults.baseURL = baseURL +``` + +References + +- [@nextcloud/router](https://github.com/nextcloud/nextcloud-router) +- [Nextcloud App Routing](https://docs.nextcloud.com/server/latest/developer_manual/basics/routing.html)