index.js 657 Bytes
import Vue from "vue";
import VueRouter from "vue-router";
import axios from "axios";
Vue.prototype.$axios = axios;
const apiRootPath =
  process.env.NODE_ENV !== "production"
    ? "http://localhost:8000/api/"
    : "/api/";
Vue.prototype.$apiRootPath = apiRootPath;
axios.defaults.baseURL = apiRootPath;

Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    name: "Home",
    component: () => import("../views/Home.vue")
  },
  {
    path: "/upload",
    name: "upload",
    component: () => import("../views/Upload.vue")
  }
];

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes
});

export default router;