Guest User

Untitled

a guest
Jul 16th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. modules: ['@nuxtjs/axios'],
  2. axios: {
  3. proxy: true,
  4. baseURL: 'http://localhost:8000/api',
  5. // prefix: '/api', // it not work
  6. credentials: true,
  7. },
  8. proxy: {
  9. '/api/douban': {
  10. target: 'https://api.douban.com',
  11. changeOrigin: true,
  12. pathRewrite: { '^/api': '' },
  13. },
  14. },
  15.  
  16. async search({ commit, state }, data) {
  17. const res = await this.$axios.$get('/douban/book/search', { params: data });
  18. commit('SET_BOOK_QUERY', res);
  19. return res;
  20. },
  21.  
  22. function shouldProxy (context, req) {
  23. var path = (req.originalUrl || req.url)
  24. console.log('shouldProxy path:', context, path);// output:shouldProxy path: /api/douban /admin/read
  25. return contextMatcher.match(context, path, req)
  26. }
Add Comment
Please, Sign In to add comment