Skip to content

Commit 6a8860f

Browse files
author
Vinicius Reis
committed
📝 improve README.md
Signed-off-by: Vinicius Reis <vinicius.reis@nextcloud.com>
1 parent 5dc22e8 commit 6a8860f

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

README.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,12 @@ Simple, typed wrapper of an Axios instance for Nextcloud that automatically send
77

88
## Installation
99

10+
```sh
11+
npm install @nextcloud/axios --save
1012
```
11-
npm i -S @nextcloud/axios
13+
14+
```sh
15+
yarn add @nextcloud/axios
1216
```
1317

1418
## Usage
@@ -20,3 +24,21 @@ axios.get('nextcloud.com')
2024
```
2125

2226
See https://github.com/axios/axios for details.
27+
28+
### Defining `baseURL`
29+
30+
You are able to define [`baseURL`](https://axios-http.com/docs/config_defaults) to simplify the usage of axios across your app.
31+
32+
```ts
33+
import axios from '@nextcloud/axios'
34+
import { generateUrl } from '@nextcloud/router'
35+
36+
const baseURL = generateUrl('/apps/your_app_id/api')
37+
38+
axios.defaults.baseURL = baseURL
39+
```
40+
41+
References
42+
43+
- [@nextcloud/router](https://github.com/nextcloud/nextcloud-router)
44+
- [Nextcloud App Routing](https://docs.nextcloud.com/server/latest/developer_manual/basics/routing.html)

0 commit comments

Comments
 (0)