Skip to content

Commit 7847330

Browse files
Tahulatinux
andauthored
docs: upgrade to latest Docus (#214)
* feat(docs): upgrade to latest Docus * update Co-authored-by: Sébastien Chopin <[email protected]>
1 parent 15b5921 commit 7847330

25 files changed

+4540
-9962
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414
- [&nbsp;Release Notes](https://http.nuxtjs.org/releases)
1515
- [📖 &nbsp;Documentation](https://http.nuxtjs.org)
1616

17+
## Nuxt 3
18+
19+
HTTP module supports Nuxt 2. Nuxt 3 users can use the new isomorphic [$fetch API](https://nuxt.com/docs/getting-started/data-fetching#isomorphic-fetch-and-fetch) ([migration guide](https://nuxt.com/docs/migration/component-options#isomorphic-fetch)).
20+
1721
## Features
1822

1923
- The fluent [ky](https://github.com/sindresorhus/ky) API has been extended with enhancements and shortcuts

docs/app.config.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
export default defineAppConfig({
2+
docus: {
3+
url: 'https://http.nuxtjs.org',
4+
header: {
5+
logo: true
6+
},
7+
socials: {
8+
twitter: 'nuxt_js',
9+
github: 'nuxt/http'
10+
},
11+
}
12+
})

docs/components/Logo.vue

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<template>
2+
<svg width="175" height="40" viewBox="0 0 175 40" fill="none" xmlns="http://www.w3.org/2000/svg">
3+
<path
4+
d="M43.82 28V14.112H46.984L47.264 16.464C47.6933 15.6427 48.3093 14.9893 49.112 14.504C49.9333 14.0187 50.8947 13.776 51.996 13.776C53.7133 13.776 55.048 14.3173 56 15.4C56.952 16.4827 57.428 18.0693 57.428 20.16V28H53.844V20.496C53.844 19.3013 53.6013 18.3867 53.116 17.752C52.6307 17.1173 51.8747 16.8 50.848 16.8C49.84 16.8 49.0093 17.1547 48.356 17.864C47.7213 18.5733 47.404 19.5627 47.404 20.832V28H43.82ZM66.0632 28.336C64.3272 28.336 62.9832 27.7947 62.0312 26.712C61.0978 25.6293 60.6312 24.0427 60.6312 21.952V14.112H64.1872V21.616C64.1872 22.8107 64.4298 23.7253 64.9152 24.36C65.4005 24.9947 66.1658 25.312 67.2112 25.312C68.2005 25.312 69.0125 24.9573 69.6472 24.248C70.3005 23.5387 70.6272 22.5493 70.6272 21.28V14.112H74.2112V28H71.0472L70.7672 25.648C70.3378 26.4693 69.7125 27.1227 68.8912 27.608C68.0885 28.0933 67.1458 28.336 66.0632 28.336ZM76.5743 28L81.6143 21.056L76.5743 14.112H80.4103L83.9383 19.04L87.4383 14.112H91.3023L86.2343 21.056L91.3023 28H87.4383L83.9383 23.072L80.4103 28H76.5743ZM99.7736 28C98.3176 28 97.151 27.6453 96.2736 26.936C95.3963 26.2267 94.9576 24.9667 94.9576 23.156V17.108H92.5776V14.112H94.9576L95.3776 10.388H98.5416V14.112H102.294V17.108H98.5416V23.184C98.5416 23.856 98.6816 24.3227 98.9616 24.584C99.2603 24.8267 99.7643 24.948 100.474 24.948H102.21V28H99.7736ZM104.195 31.108L111.195 6.244H114.695L107.667 31.108H104.195Z"
5+
fill="var(--logo-color)" />
6+
<path
7+
d="M117.156 28V7.84H120.74V16.24C121.207 15.4747 121.832 14.8773 122.616 14.448C123.419 14 124.333 13.776 125.36 13.776C127.077 13.776 128.403 14.3173 129.336 15.4C130.288 16.4827 130.764 18.0693 130.764 20.16V28H127.208V20.496C127.208 19.3013 126.965 18.3867 126.48 17.752C126.013 17.1173 125.267 16.8 124.24 16.8C123.232 16.8 122.392 17.1547 121.72 17.864C121.067 18.5733 120.74 19.5627 120.74 20.832V28H117.156ZM140.379 28C138.923 28 137.756 27.6453 136.879 26.936C136.002 26.2267 135.563 24.9667 135.563 23.156V17.108H133.183V14.112H135.563L135.983 10.388H139.147V14.112H142.899V17.108H139.147V23.184C139.147 23.856 139.287 24.3227 139.567 24.584C139.866 24.8267 140.37 24.948 141.079 24.948H142.815V28H140.379ZM152.164 28C150.708 28 149.542 27.6453 148.664 26.936C147.787 26.2267 147.348 24.9667 147.348 23.156V17.108H144.968V14.112H147.348L147.768 10.388H150.932V14.112H154.684V17.108H150.932V23.184C150.932 23.856 151.072 24.3227 151.352 24.584C151.651 24.8267 152.155 24.948 152.864 24.948H154.6V28H152.164ZM157.761 34.16V14.112H160.953L161.345 16.1C161.793 15.484 162.381 14.9427 163.109 14.476C163.856 14.0093 164.817 13.776 165.993 13.776C167.3 13.776 168.467 14.0933 169.493 14.728C170.52 15.3627 171.332 16.2307 171.929 17.332C172.527 18.4333 172.825 19.684 172.825 21.084C172.825 22.484 172.527 23.7347 171.929 24.836C171.332 25.9187 170.52 26.7773 169.493 27.412C168.467 28.028 167.3 28.336 165.993 28.336C164.948 28.336 164.033 28.14 163.249 27.748C162.465 27.356 161.831 26.8053 161.345 26.096V34.16H157.761ZM165.237 25.2C166.376 25.2 167.319 24.8173 168.065 24.052C168.812 23.2867 169.185 22.2973 169.185 21.084C169.185 19.8707 168.812 18.872 168.065 18.088C167.319 17.304 166.376 16.912 165.237 16.912C164.08 16.912 163.128 17.304 162.381 18.088C161.653 18.8533 161.289 19.8427 161.289 21.056C161.289 22.2693 161.653 23.268 162.381 24.052C163.128 24.8173 164.08 25.2 165.237 25.2Z"
8+
fill="#00DC82" />
9+
<mask id="mask0" mask-type="alpha" maskUnits="userSpaceOnUse" x="1" y="5" width="30" height="30">
10+
<path
11+
d="M27.2008 33.2309C19.8319 34.9446 12.1681 34.9446 4.7992 33.2309C3.7909 32.9964 3.0036 32.2091 2.76911 31.2008C1.05541 23.8319 1.05541 16.1681 2.76911 8.7992C3.0036 7.7909 3.7909 7.0036 4.7992 6.76911C12.1681 5.05541 19.8319 5.05541 27.2008 6.76911C28.2091 7.0036 28.9964 7.7909 29.2309 8.7992C30.9446 16.1681 30.9446 23.8319 29.2309 31.2008C28.9964 32.2091 28.2091 32.9964 27.2008 33.2309Z"
12+
fill="#00DC82" stroke="black" stroke-width="0.32" />
13+
</mask>
14+
<g mask="url(#mask0)">
15+
<path fill-rule="evenodd" clip-rule="evenodd"
16+
d="M20.9369 4.60376H0.52832V32.9828L3.45343 36H15.4372L25.4888 30.1967C26.0893 29.85 26.295 29.0822 25.9483 28.4817L20.3068 18.7104C19.9601 18.1099 20.1659 17.3421 20.7663 16.9954L24.2791 14.9673C24.8795 14.6206 25.6474 14.8264 25.9941 15.4268L32 25.8295V5.8387C31.9349 5.86292 31.871 5.89289 31.8088 5.92878L15.0798 15.5873C14.4793 15.934 14.2736 16.7018 14.6203 17.3023L20.2618 27.0736C20.6085 27.6741 20.4027 28.4419 19.8022 28.7886L16.2649 30.8309C15.6644 31.1776 14.8966 30.9718 14.5499 30.3714L5.61669 14.8986C5.27001 14.2981 5.47574 13.5303 6.07622 13.1836L20.9369 4.60376ZM28.6041 36L32 34.0394V36H28.6041Z"
17+
fill="#00DC82" />
18+
</g>
19+
</svg>
20+
</template>
21+
22+
<style lang="ts" scoped>
23+
css({
24+
svg: {
25+
'--logo-color': '#003C3C',
26+
'@dark': {
27+
'--logo-color': '{color.white}'
28+
}
29+
}
30+
})
31+
</style>

docs/pages/en/1.getting-started/1.setup.md renamed to docs/content/1.getting-started/1.setup.md

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
---
2-
title: Setup
3-
description: 'How to setup your module'
1+
# Setup
2+
3+
How to setup your module.
4+
45
---
56

67
Checkout the [Nuxt documentation](https://nuxtjs.org/api/configuration-modules#the-modules-property) for more information about installing and using modules.
@@ -9,22 +10,15 @@ Checkout the [Nuxt documentation](https://nuxtjs.org/api/configuration-modules#t
910

1011
Add `@nuxt/http` dependency to your project:
1112

12-
:::::code-group
13-
::::code-block{label="Yarn" active}
14-
15-
```bash
13+
::code-group
14+
```bash [Yarn]
1615
yarn add @nuxt/http
1716
```
1817

19-
::::
20-
::::code-block{label="NPM"}
21-
22-
```bash
18+
```bash [NPM]
2319
npm install @nuxt/http
2420
```
25-
26-
::::
27-
:::::
21+
::
2822

2923
Then add it to the modules section in your `nuxt.config.js`:
3024

@@ -34,9 +28,9 @@ export default {
3428
}
3529
```
3630

37-
:::alert{type="success"}
31+
::alert{type="success"}
3832
That's it! You can now use [$http](/usage) in your Nuxt app ✨
39-
:::
33+
::
4034

4135
## Configure
4236

@@ -56,9 +50,9 @@ export default {
5650

5751
See [http's options](/API/options).
5852

59-
:::alert{type="warning"}
53+
::alert{type="warning"}
6054
Note that this module does not currently support IE 11 because of using [ky](https://github.com/sindresorhus/ky) ([open issue](https://github.com/nuxt/http/issues/126))
61-
:::
55+
::
6256

6357
## TypeScript
6458

docs/pages/en/1.getting-started/2.usage.md renamed to docs/content/1.getting-started/2.usage.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
---
2-
title: Usage
3-
description: 'How to use this module'
1+
# Usage
2+
3+
How to use this module.
4+
45
---
56

67
## Making Requests
@@ -108,9 +109,9 @@ methods: {
108109
}
109110
```
110111

111-
:::alert{type="info"}
112+
::alert{type="info"}
112113
`this` is not available in Nuxt's `asyncData` method, see [using in `asyncData`](#using-in-asyncdata) for how to use this module in `asyncData`
113-
:::
114+
::
114115

115116
## Using in Store
116117

docs/pages/en/1.getting-started/3.http-methods.md renamed to docs/content/1.getting-started/3.http-methods.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
---
2-
title: HTTP Methods
3-
description: 'HTTP Methods'
2+
description: 'HTTP Methods.'
43
---
54

6-
:::alert{type="info"}
5+
# HTTP Methods
6+
7+
---
8+
9+
::alert{type="info"}
710
Each http method returns a `Promise`
8-
:::
11+
::
912

1013
### `$get`
1114

docs/pages/en/1.getting-started/4.advanced.md renamed to docs/content/1.getting-started/4.advanced.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
---
2-
title: Advanced
3-
description: 'Advanced concepts'
1+
# Advanced
2+
3+
Advanced concepts.
4+
45
---
56

67
## Hooks
@@ -53,15 +54,15 @@ export default function ({ $http }) {
5354

5455
Globally set a header to all subsequent requests.
5556

56-
:::alert{type="warning"}
57+
::alert{type="warning"}
5758
This method should probably not be called inside hooks as it is global and will apply to all future requests
58-
:::
59+
::
5960

60-
:::alert{type="info"}
61+
::alert{type="info"}
6162
Please note that HTTP headers are case-insensitive. Therefore all header names will be converted to lower-case to make sure that if you set the same header twice but with different casing the last one set will be used.
6263

6364
See also [this comment](https://github.com/sindresorhus/ky/issues/105#issuecomment-470169100) in the Ky repository for more information
64-
:::
65+
::
6566

6667
Parameters:
6768

@@ -86,9 +87,9 @@ this.$http.setHeader('Content-Type', false)
8687

8788
Globally set `Authorization` header to all subsequent requests.
8889

89-
:::alert{type="info"}
90+
::alert{type="info"}
9091
This is a global method, you only have to call it once after which all future requests will include the token
91-
:::
92+
::
9293

9394
Parameters:
9495

docs/pages/en/1.index.md renamed to docs/content/1.index.md

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
1-
---
2-
title: Introduction
3-
description: 'HTTP module for Nuxt.js provides a universal way to make HTTP requests to the API backend.'
4-
---
1+
# Introduction
52

6-
:::alert{type="warning"}
7-
HTTP module supports Nuxt 2. Nuxt 3 users can use the new isomorphic [$fetch API](https://v3.nuxtjs.org/getting-started/data-fetching#isomorphic-fetch-and-fetch) ([migration guide](https://v3.nuxtjs.org/docs/migration/component-options#isomorphic-fetch)).
8-
:::
3+
HTTP module for Nuxt.js provides a universal way to make HTTP requests to the API backend.
94

5+
---
106

11-
<img src="/preview.png" class="transition-shadow duration-200 rounded-md shadow light-img hover:shadow-lg" />
12-
13-
<img src="/preview-dark.png" class="transition-shadow duration-200 rounded-md shadow dark-img hover:shadow-lg" />
7+
::alert{type="warning"}
8+
HTTP module supports Nuxt 2. Nuxt 3 users can use the new isomorphic [$fetch API](https://nuxt.com/docs/getting-started/data-fetching#isomorphic-fetch-and-fetch) ([migration guide](https://nuxt.com/docs/migration/component-options#isomorphic-fetch)).
9+
::
1410

1511
The HTTP module for [Nuxt](https://nuxtjs.org) provides a universal way to make HTTP requests to any API.
1612

@@ -22,15 +18,15 @@ Starting from [v2.5.0](https://github.com/nuxt/nuxt.js/releases/tag/v2.5.0), Nux
2218
2319
## Features
2420

25-
:::list
21+
::list
2622

2723
- The fluent ky API has been extended with enhancements and shortcuts
2824
- Highly customizable options support for `BaseURL`
2925
- Automatically proxy cookies and headers when making requests from server side
3026
- Best practices to avoid token sharing when making server side requests
3127
- Easy proxy support to avoid CORS problems and making deployment easier
3228

33-
:::
29+
::
3430

3531
## Links
3632

docs/pages/en/2.API/1.options.md renamed to docs/content/2.API/1.options.md

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
---
2-
title: Options
3-
description: 'You can pass options using module options or http section in nuxt.config.js'
4-
---
1+
# Options
52

6-
You can pass options using module options or `http` section in `nuxt.config.js`
3+
You can pass options using module options or `http` section in `nuxt.config.js`.
4+
5+
---
76

87
```js
98
{
@@ -33,9 +32,9 @@ Base URL which is used and prepended to make requests in server side.
3332

3433
Environment variable `API_URL` can be used to **override** `baseURL`.
3534

36-
:::alert{type="info"}
35+
::alert{type="info"}
3736
`baseURL` and `proxy` won't work together, you will need to use [`prefix`](/options#prefix) instead
38-
:::
37+
::
3938

4039
## `browserBaseURL`
4140

@@ -82,11 +81,11 @@ You can easily integrate HTTP with [Proxy Module](https://github.com/nuxt-commun
8281
}
8382
```
8483

85-
:::alert{type="info"}
84+
::alert{type="info"}
8685
It is not required to manually register `@nuxtjs/proxy` module, but it does need to be in your dependencies
87-
:::
86+
::
8887

89-
:::alert{type="info"}
88+
::alert{type="info"}
9089
`/api/` will be added to all requests to the API end point. If you need to remove it use `pathRewrite`:
9190

9291
```js
@@ -97,7 +96,7 @@ proxy: {
9796
}
9897
}
9998
```
100-
:::
99+
::
101100

102101
## `retry`
103102

@@ -147,9 +146,9 @@ In SSR context, sets client request header as http default request headers.
147146
This is useful for making requests which need cookie based auth on server side.
148147
Also helps making consistent requests in both SSR and Client Side code.
149148

150-
:::alert{type="info"}
149+
::alert{type="info"}
151150
When directing requests at a url protected by CloudFlare's CDN you should set this to `false` to prevent CloudFlare from mistakenly detecting a reverse proxy loop and returning a 403 error.
152-
:::
151+
::
153152

154153
## `proxyHeadersIgnore`
155154

@@ -163,10 +162,10 @@ Headers added to all requests. If provided, will be merged with the defaults.
163162

164163
* Default: `{}`
165164

166-
:::alert{type="info"}
165+
::alert{type="info"}
167166
Do NOT include any credentials or tokens here. One can easily access them.
168-
:::
167+
::
169168

170-
:::alert{type="info"}
169+
::alert{type="info"}
171170
This headers are effective to ALL requests. Please take care and consider providing special headers on each call that needs this unless you are pretty sure you always need to add headers.
172-
:::
171+
::

docs/pages/en/2.API/2.runtime-config.md renamed to docs/content/2.API/2.runtime-config.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
---
2-
title: Runtime Config
3-
description: 'The use of runtime config is mandatory in case of using environment variables in production.'
1+
# Runtime Config
2+
3+
The use of runtime config is mandatory in case of using environment variables in production.
4+
45
---
56

67
The use of [runtime config](https://nuxtjs.org/guide/runtime-config) is mandatory in case of using environment variables in production. Otherwise, the values will be hard coded during build and won't change until the next build.

0 commit comments

Comments
 (0)