mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-26 07:32:01 +00:00
docs: add missing config variable in example (server api) (#4184)
This commit is contained in:
parent
96657388f5
commit
55091b8fdf
@ -85,9 +85,9 @@ For example:
|
||||
|
||||
```ts
|
||||
export default defineNuxtPlugin((nuxtApp) => {
|
||||
const config = useRuntimeConfig();
|
||||
const config = useRuntimeConfig()
|
||||
|
||||
const url = process.server ? config.serverUrl : config.clientUrl;
|
||||
const url = process.server ? config.serverUrl : config.clientUrl
|
||||
|
||||
// Do something with url & isServer.
|
||||
});
|
||||
@ -100,6 +100,8 @@ Within the API routes, you can access runtime config by directly importing from
|
||||
```ts
|
||||
import { useRuntimeConfig } from '#nitro'
|
||||
|
||||
const config = useRuntimeConfig()
|
||||
|
||||
export default async () => {
|
||||
const result = await $fetch('https://my.api.com/test', {
|
||||
headers: {
|
||||
|
Loading…
Reference in New Issue
Block a user