Comments (5)
Hi. But this module without plugin would not be useful! Would you please explain your use case without plugin?
from axios-module.
can we include this into module too ?
import * as axios from 'axios'
let options = {}
// The server-side needs a full url to works
if (process.server) {
options.baseURL = `http://${process.env.HOST || 'localhost'}:${process.env.PORT || 3000}`
}
export default axios.create(options)
if ok we dont need add plugin file anymore :)
from axios-module.
No we can't. Modules run in Nuxt build lifecycle not runtime. Also inside plugins export default is not possible as we should avoid write stateful code in global context as of Vue 2.3.x (Because requests are shared)
from axios-module.
Please see https://ssr.vuejs.org/en/api.html#runinnewcontext
from axios-module.
ok i see, thanks for you answer @pi0 i just felt lazy to add more plugin when have added module...
from axios-module.
Related Issues (20)
- Problem with ssr Cors then axios and proxy
- filename.split error on nuxt generate and ssr HOT 2
- dont work on nuxt rc.6
- Cannot send cookies through server side
- Update to latest axios HOT 5
- Export `NuxtAxiosInstance` typings HOT 3
- Why does nuxtjs/axios trigger options requests
- diferrent url in nuxt 3
- Nuxt 3: Cannot start nuxt: Cannot read properties of undefined (reading 'options') HOT 3
- Nuxt3, how to fix this error HOT 2
- [Nuxt 2] defu__WEBPACK_IMPORTED_MODULE_3__ is not a function
- Is this repo still maintained & any plans to upgrade to axios v1.* ? HOT 2
- Status code is not returned for 413 responses HOT 1
- Last part of url getting removed during request
- Cannot restart nuxt: Cannot read properties of undefined (reading 'options') HOT 1
- nuxt/axios this.$axios.get() options doesn't seem to work
- Authorization header is not being set with Auth Module cookie strategy
- Release with latest axios HOT 1
- node_modules\vue-server-renderer\build.dev.js
- Security issue: Uses a vulnerable version of Axios
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from axios-module.