Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: change default api url value #354

Merged
merged 2 commits into from
Sep 8, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/content/2.setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Defaults:

```ts
{
url: process.env.STRAPI_URL || 'http://localhost:1337',
url: process.env.STRAPI_URL || 'http://127.0.0.1:1337',
prefix: '/api',
version: 'v4',
cookie: {},
Expand All @@ -47,7 +47,7 @@ If you want to override any options on runtime, you may use [Nuxt 3 runtime-conf
runtimeConfig: {
public: {
strapi: {
url: 'http://localhost:1337' // can be overridden by NUXT_PUBLIC_STRAPI_URL environment variable
url: 'http://127.0.0.1:1337' // can be overridden by NUXT_PUBLIC_STRAPI_URL environment variable
}
}
},
Expand Down
6 changes: 3 additions & 3 deletions example/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ export default defineNuxtConfig({
],
// example of separate client/server URLs
// runtimeConfig: {
// strapi: { url: 'http://localhost:1337' },
// strapi: { url: 'http://127.0.0.1:1337' },
// public: {
// strapi: { url: 'http://localhost:1337' }
// strapi: { url: 'http://127.0.0.1:1337' }
// }
// },
strapi: {
version: 'v3',
url: 'http://localhost:1337'
url: 'http://127.0.0.1:1337'
// To enable the devtools, read https://strapi.nuxtjs.org/devtools
// devtools: true
},
Expand Down
6 changes: 3 additions & 3 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export interface ModuleOptions {
/**
* Strapi API URL
* @default process.env.STRAPI_URL
* @example 'http://localhost:1337'
* @example 'http://127.0.0.1:1337'
* @type string
*/
url?: string
Expand Down Expand Up @@ -74,15 +74,15 @@ export default defineNuxtModule<ModuleOptions>({
}
},
defaults: {
url: process.env.STRAPI_URL || 'http://localhost:1337',
url: process.env.STRAPI_URL || 'http://127.0.0.1:1337',
prefix: '/api',
version: 'v4',
cookie: {},
auth: {},
cookieName: 'strapi_jwt',
devtools: false
},
setup (options, nuxt) {
setup(options, nuxt) {
benjamincanac marked this conversation as resolved.
Show resolved Hide resolved
// Default runtimeConfig
nuxt.options.runtimeConfig.public.strapi = defu(nuxt.options.runtimeConfig.public.strapi, options)
nuxt.options.runtimeConfig.strapi = defu(nuxt.options.runtimeConfig.strapi, options)
Expand Down