Skip to content
This repository was archived by the owner on Feb 2, 2021. It is now read-only.

Commit 1a23abb

Browse files
committed
docs: update api options
1 parent 1112d47 commit 1a23abb

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

docs/content/Configuration.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,23 +71,27 @@ module.exports = {
7171

7272
# API Options
7373

74-
For custom environments, you must configure the `baseURL`, so that the content's `serverMiddleware` API and `axios` requests helpers can be setup appropriately.
74+
For custom environments, you must configure the `browserBaseURL`, so that the content's `serverMiddleware` API and `axios` requests helpers can be setup appropriately.
7575

76-
- `baseURL`, String that specifies that the site's base url.
76+
- `browserBaseURL`, String that specifies the site's base url when content is requested from the browser.
7777

78-
*Note: You can use environment variables to dynamically set the base url.*
78+
*Note: You can specify the `api` option as a function receiving an `isStatic` parameter to dynamically set the api options depending on the fact you're making a static build ('nuxt generate') or not.*
7979

8080
```js
8181
module.exports = {
82-
api: {
83-
baseURL: process.env.NODE_ENV === 'production'
84-
? 'http://production-url.com'
85-
: 'http://localhost:3000'
86-
}
82+
api: function(isStatic) {
83+
return {
84+
browserBaseURL: isStatic ? 'http://production-url.com' : ''
85+
}
86+
}
8787
}
8888

8989
```
9090

91+
API options are also passed down to `axios` if you need a specific configuration (see [axios options](https://github.com/nuxt-community/axios-module#options)).
92+
93+
*Note: Remember not to alter the `baseUrl` parameter in a way that would prevent nuxtent to access the content server (i.e. by specifying a remote url).*
94+
9195
# Parser Options
9296

9397
You can also configure additional processing to be used Nuxtent parsers.

0 commit comments

Comments
 (0)