├── .prettierrc.js
├── babel.config.js
├── public
├── favicon.ico
└── index.html
├── src
├── assets
│ └── logo.png
├── views
│ ├── About.vue
│ ├── EventDetails.vue
│ └── EventList.vue
├── store
│ └── index.js
├── main.js
├── services
│ └── EventService.js
├── router
│ └── index.js
├── App.vue
└── components
│ └── EventCard.vue
├── .gitignore
├── README.md
├── package.json
└── db.json
/.prettierrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | singleQuote: true,
3 | semi: false
4 | }
5 |
--------------------------------------------------------------------------------
/babel.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | presets: ["@vue/cli-plugin-babel/preset"]
3 | };
4 |
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Code-Pop/Touring-Vue-Router/HEAD/public/favicon.ico
--------------------------------------------------------------------------------
/src/assets/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Code-Pop/Touring-Vue-Router/HEAD/src/assets/logo.png
--------------------------------------------------------------------------------
/src/views/About.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
A site for events to better the world.
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/store/index.js:
--------------------------------------------------------------------------------
1 | import { createStore } from 'vuex'
2 |
3 | export default createStore({
4 | state: {},
5 | mutations: {},
6 | actions: {},
7 | modules: {}
8 | })
9 |
--------------------------------------------------------------------------------
/src/main.js:
--------------------------------------------------------------------------------
1 | import { createApp } from 'vue'
2 | import App from './App.vue'
3 | import router from './router'
4 | import store from './store'
5 |
6 | createApp(App)
7 | .use(store)
8 | .use(router)
9 | .mount('#app')
10 |
--------------------------------------------------------------------------------
/.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 |
--------------------------------------------------------------------------------
/src/services/EventService.js:
--------------------------------------------------------------------------------
1 | import axios from 'axios'
2 |
3 | const apiClient = axios.create({
4 | baseURL: 'https://my-json-server.typicode.com/Code-Pop/Touring-Vue-Router',
5 | withCredentials: false,
6 | headers: {
7 | Accept: 'application/json',
8 | 'Content-Type': 'application/json'
9 | }
10 | })
11 |
12 | export default {
13 | getEvents() {
14 | return apiClient.get('/events')
15 | },
16 | getEvent(id) {
17 | return apiClient.get('/events/' + id)
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Touring Vue Router Example App
2 |
3 | This is the Vue 3 application we build step by step in the Touring Vue Router course on Vue Mastery. It's starting code is based on the final code from the Real World Vue 3 course.
4 |
5 | ## Project setup
6 |
7 | ```
8 | npm install
9 | ```
10 |
11 | ### Compiles and hot-reloads for development
12 |
13 | ```
14 | npm run serve
15 | ```
16 |
17 | ### Compiles and minifies for production
18 |
19 | ```
20 | npm run build
21 | ```
22 |
23 | ### Lints and fixes files
24 |
25 | ```
26 | npm run lint
27 | ```
28 |
29 | ### Customize configuration
30 |
31 | See [Configuration Reference](https://cli.vuejs.org/config/).
32 |
--------------------------------------------------------------------------------
/src/views/EventDetails.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
{{ event.title }}
4 |
{{ event.time }} on {{ event.date }} @ {{ event.location }}
5 |
{{ event.description }}
6 |
7 |
8 |
9 |
29 |
--------------------------------------------------------------------------------
/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | <%= htmlWebpackPlugin.options.title %>
9 |
10 |
11 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/src/router/index.js:
--------------------------------------------------------------------------------
1 | import { createRouter, createWebHistory } from 'vue-router'
2 | import EventList from '../views/EventList.vue'
3 | import EventDetails from '../views/EventDetails.vue'
4 | import About from '../views/About.vue'
5 |
6 | const routes = [
7 | {
8 | path: '/',
9 | name: 'EventList',
10 | component: EventList
11 | },
12 | {
13 | path: '/event/:id',
14 | name: 'EventDetails',
15 | props: true,
16 | component: EventDetails
17 | },
18 | {
19 | path: '/about',
20 | name: 'About',
21 | component: About
22 | }
23 | ]
24 |
25 | const router = createRouter({
26 | history: createWebHistory(process.env.BASE_URL),
27 | routes
28 | })
29 |
30 | export default router
31 |
--------------------------------------------------------------------------------
/src/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Events |
5 | About
6 |
7 |
8 |
9 |
10 |
11 |
37 |
--------------------------------------------------------------------------------
/src/views/EventList.vue:
--------------------------------------------------------------------------------
1 |
2 | Events for Good
3 |
4 |
5 |
6 |
7 |
8 |
33 |
34 |
41 |
--------------------------------------------------------------------------------
/src/components/EventCard.vue:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 | @{{ event.time }} on {{ event.date }}
8 |
{{ event.title }}
9 |
10 |
11 |
12 |
13 |
23 |
24 |
43 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "real-world-vue",
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-0",
13 | "vue-router": "^4.0.0-0",
14 | "vuex": "^4.0.0-0"
15 | },
16 | "devDependencies": {
17 | "@vue/cli-plugin-babel": "~4.5.0",
18 | "@vue/cli-plugin-eslint": "~4.5.0",
19 | "@vue/cli-plugin-router": "~4.5.0",
20 | "@vue/cli-plugin-vuex": "~4.5.0",
21 | "@vue/cli-service": "~4.5.0",
22 | "@vue/compiler-sfc": "^3.0.0-0",
23 | "@vue/eslint-config-prettier": "^6.0.0",
24 | "axios": "^0.20.0",
25 | "babel-eslint": "^10.1.0",
26 | "eslint": "^6.7.2",
27 | "eslint-plugin-prettier": "^3.1.3",
28 | "eslint-plugin-vue": "^7.0.0-0",
29 | "prettier": "^1.19.1"
30 | },
31 | "eslintConfig": {
32 | "root": true,
33 | "env": {
34 | "node": true
35 | },
36 | "extends": [
37 | "plugin:vue/vue3-essential",
38 | "eslint:recommended",
39 | "@vue/prettier"
40 | ],
41 | "parserOptions": {
42 | "parser": "babel-eslint"
43 | },
44 | "rules": {}
45 | },
46 | "browserslist": [
47 | "> 1%",
48 | "last 2 versions",
49 | "not dead"
50 | ]
51 | }
52 |
--------------------------------------------------------------------------------
/db.json:
--------------------------------------------------------------------------------
1 | {
2 | "events": [
3 | {
4 | "id": 123,
5 | "category": "animal welfare",
6 | "title": "Cat Adoption Day",
7 | "description": "Find your new feline friend at this event.",
8 | "location": "Meow Town",
9 | "date": "January 28, 2022",
10 | "time": "12:00",
11 | "petsAllowed": true,
12 | "organizer": "Kat Laydee"
13 | },
14 | {
15 | "id": 456,
16 | "category": "food",
17 | "title": "Community Gardening",
18 | "description": "Join us as we tend to the community edible plants.",
19 | "location": "Flora City",
20 | "date": "March 14, 2022",
21 | "time": "10:00",
22 | "petsAllowed": true,
23 | "organizer": "Fern Pollin"
24 | },
25 | {
26 | "id": 789,
27 | "category": "sustainability",
28 | "title": "Beach Cleanup",
29 | "description": "Help pick up trash along the shore.",
30 | "location": "Playa Del Carmen",
31 | "date": "July 22, 2022",
32 | "time": "11:00",
33 | "petsAllowed": false,
34 | "organizer": "Carey Wales"
35 | },
36 | {
37 | "id": 1001,
38 | "category": "animal welfare",
39 | "title": "Dog Adoption Day",
40 | "description": "Find your new canine friend at this event.",
41 | "location": "Woof Town",
42 | "date": "August 28, 2022",
43 | "time": "12:00",
44 | "petsAllowed": true,
45 | "organizer": "Dawg Dahd"
46 | },
47 | {
48 | "id": 1002,
49 | "category": "food",
50 | "title": "Canned Food Drive",
51 | "description": "Bring your canned food to donate to those in need.",
52 | "location": "Tin City",
53 | "date": "September 14, 2022",
54 | "time": "3:00",
55 | "petsAllowed": true,
56 | "organizer": "Kahn Opiner"
57 | },
58 | {
59 | "id": 1003,
60 | "category": "sustainability",
61 | "title": "Highway Cleanup",
62 | "description": "Help pick up trash along the highway.",
63 | "location": "Highway 50",
64 | "date": "July 22, 2022",
65 | "time": "11:00",
66 | "petsAllowed": false,
67 | "organizer": "Brody Kill"
68 | }
69 | ]
70 | }
71 |
--------------------------------------------------------------------------------