Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- modules: ['@nuxtjs/axios'],
- axios: {
- proxy: true,
- baseURL: 'http://localhost:8000/api',
- // prefix: '/api', // it not work
- credentials: true,
- },
- proxy: {
- '/api/douban': {
- target: 'https://api.douban.com',
- changeOrigin: true,
- pathRewrite: { '^/api': '' },
- },
- },
- async search({ commit, state }, data) {
- const res = await this.$axios.$get('/douban/book/search', { params: data });
- commit('SET_BOOK_QUERY', res);
- return res;
- },
- function shouldProxy (context, req) {
- var path = (req.originalUrl || req.url)
- console.log('shouldProxy path:', context, path);// output:shouldProxy path: /api/douban /admin/read
- return contextMatcher.match(context, path, req)
- }
Add Comment
Please, Sign In to add comment