hope you are well! I am working in a project CRUD web application that handles user management. Create user, edit user, delete user.
- First I set up my project install VueJS after that installed vue-bootstrap make import in file main.js. For mocking the Backend I have used : NPM install -g json-server After that, create a new file called db.json that handles users in the root of a project. I run command json-server --watch db.json to make record available. http://localhost:3000/users
I have installed axis for us to be able to send and receive data from our backand. So I have run command npm install axios.
But after it how I have import axios in file main.js, but I am not confident if is the right way?? Thanks
import Vue from 'vue'
import App from './App.vue'
import router from './router'
import { BootstrapVue, IconsPlugin } from "bootstrap-vue";
import axios from 'axios'
//Import Bootstrap an BootstrapVue CSS files (order is important)
import "bootstrap/dist/css/bootstrap.css";
import "bootstrap-vue/dist/bootstrap-vue.css";
// Make BootstrapVue available throughout your project
Vue.use(BootstrapVue);
Vue.use(IconsPlugin);
Vue.config.productionTip = false
Vue.use({
install (Vue) {
Vue.prototype.$api = axios.create({
baseURL: 'http://localhost:8000/users/'
})
}
})
new Vue({
router,
render: h => h(App)
}).$mount('#app')