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