├── .gitignore ├── README.md ├── babel.config.js ├── package-lock.json ├── package.json ├── public ├── favicon.ico └── index.html ├── src ├── App.vue ├── assets │ └── logo.png ├── http-common.js └── main.js └── vue-axios-example.png /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /dist 4 | 5 | 6 | # local env files 7 | .env.local 8 | .env.*.local 9 | 10 | # Log files 11 | npm-debug.log* 12 | yarn-debug.log* 13 | yarn-error.log* 14 | pnpm-debug.log* 15 | 16 | # Editor directories and files 17 | .idea 18 | .vscode 19 | *.suo 20 | *.ntvs* 21 | *.njsproj 22 | *.sln 23 | *.sw? 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Vue Axios example with Rest API 2 | 3 | Vue Client with Axios to make CRUD requests to Rest API in that: 4 | - Vue Axios GET request: get all Tutorials, get Tutorial by Id, find Tutorial by title 5 | - Vue Axios POST request: create new Tutorial 6 | - Vue Axios PUT request: update an existing Tutorial 7 | - Vue Axios DELETE request: delete a Tutorial, delete all Tutorials 8 | 9 |  10 | 11 | For instruction, please visit: 12 | > [Vue Axios example - Get/Post/Put/Delete with Rest API](https://www.bezkoder.com/vue-axios-example/) 13 | 14 | Related Posts: 15 | > [Vue Fetch example - Get/Post/Put/Delete with Rest API](https://www.bezkoder.com/vue-fetch-example/) 16 | 17 | > [Vue 2 CRUD example with Axios and Vue Router](https://www.bezkoder.com/vue-js-crud-app/) 18 | 19 | > [Vue 3 CRUD example with Axios and Vue Router](https://www.bezkoder.com/vue-3-crud/) 20 | 21 | More Practice: 22 | > [Vue Pagination with Axios and API example](https://www.bezkoder.com/vue-pagination-axios/) 23 | 24 | > [Vue JWT Authentication with Vuex and Vue Router](https://www.bezkoder.com/jwt-vue-vuex-authentication/) 25 | 26 | > [Vue File Upload example using Axios](https://www.bezkoder.com/vue-axios-file-upload/) 27 | 28 | Fullstack with Node Express: 29 | > [Vue + Node Express + MySQL](https://www.bezkoder.com/vue-js-node-js-express-mysql-crud-example/) 30 | 31 | > [Vue + Node Express + PostgreSQL](https://www.bezkoder.com/vue-node-express-postgresql/) 32 | 33 | > [Vue + Node Express + MongoDB](https://www.bezkoder.com/vue-node-express-mongodb-mevn-crud/) 34 | 35 | Fullstack with Spring Boot: 36 | > [Vue + Spring Boot](https://www.bezkoder.com/spring-boot-vue-js-crud-example/) 37 | 38 | > [Vue + Spring Boot + MongoDB](https://www.bezkoder.com/spring-boot-vue-mongodb/) 39 | 40 | Fullstack with Django: 41 | > [Vue + Django](https://www.bezkoder.com/django-vue-js-rest-framework/) 42 | 43 | Integration (run back-end & front-end on same server/port) 44 | > [Integrate Vue with Spring Boot](https://www.bezkoder.com/integrate-vue-spring-boot/) 45 | 46 | > [Integrate Vue App with Node Express](https://www.bezkoder.com/serve-vue-app-express/) 47 | 48 | Serverless with Firebase: 49 | > [Vue Firebase Realtime Database: CRUD example](https://www.bezkoder.com/vue-firebase-realtime-database/) 50 | 51 | > [Vue Firestore CRUD example](https://www.bezkoder.com/vue-firestore-crud/) 52 | 53 | ## Project setup 54 | ``` 55 | npm install 56 | ``` 57 | 58 | ### Compiles and hot-reloads for development 59 | ``` 60 | npm run serve 61 | ``` 62 | 63 | ### Compiles and minifies for production 64 | ``` 65 | npm run build 66 | ``` 67 | 68 | ### Lints and fixes files 69 | ``` 70 | npm run lint 71 | ``` 72 | 73 | ### Customize configuration 74 | See [Configuration Reference](https://cli.vuejs.org/config/). 75 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | '@vue/cli-plugin-babel/preset' 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vue-axios-example", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "serve": "vue-cli-service serve", 7 | "build": "vue-cli-service build", 8 | "lint": "vue-cli-service lint" 9 | }, 10 | "dependencies": { 11 | "axios": "^0.22.0", 12 | "core-js": "^3.6.5", 13 | "vue": "^3.0.0" 14 | }, 15 | "devDependencies": { 16 | "@vue/cli-plugin-babel": "~4.5.0", 17 | "@vue/cli-plugin-eslint": "~4.5.0", 18 | "@vue/cli-service": "~4.5.0", 19 | "@vue/compiler-sfc": "^3.0.0", 20 | "babel-eslint": "^10.1.0", 21 | "eslint": "^6.7.2", 22 | "eslint-plugin-vue": "^7.0.0" 23 | }, 24 | "eslintConfig": { 25 | "root": true, 26 | "env": { 27 | "node": true 28 | }, 29 | "extends": [ 30 | "plugin:vue/vue3-essential", 31 | "eslint:recommended" 32 | ], 33 | "parserOptions": { 34 | "parser": "babel-eslint" 35 | }, 36 | "rules": {} 37 | }, 38 | "browserslist": [ 39 | "> 1%", 40 | "last 2 versions", 41 | "not dead" 42 | ] 43 | } 44 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bezkoder/vue-axios-example/c61b4eb58e80fb49d7b566e36e7f511fbe112ff2/public/favicon.ico -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 |{{getResult}}
{{postResult}}
{{putResult}}
{{deleteResult}}