├── .gitignore ├── README.md ├── babel.config.js ├── package.json ├── public ├── favicon.ico └── index.html ├── server.js ├── src ├── App.vue ├── assets │ └── logo.png ├── components │ ├── Calendar.vue │ ├── ColorPicker.vue │ ├── EventForm.vue │ └── HelloWorld.vue └── main.js └── yarn.lock /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /dist 4 | .env 5 | # local env files 6 | .env.local 7 | .env.*.local 8 | 9 | # Log files 10 | npm-debug.log* 11 | yarn-debug.log* 12 | yarn-error.log* 13 | 14 | # Editor directories and files 15 | .idea 16 | .vscode 17 | *.suo 18 | *.ntvs* 19 | *.njsproj 20 | *.sln 21 | *.sw* 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Realtime event scheduling application 2 | 3 | Realtime event scheduling using Pusher and VueJS 4 | 5 | ## Prerequisites 6 | 7 | - [Vue](https://vuejs.org/) 8 | - [Express](https://expressjs.com/) 9 | - [Pusher](https://pusher.com) 10 | - A [Pusher account](https://pusher.com/signup) and [Pusher app credentials](http://dashboard.pusher.com/) 11 | 12 | ## Getting started 13 | 14 | - Clone the project and install dependencies: 15 | - Create a file named `.env`. Update the `.env` file with the content below: 16 | 17 | ``` 18 | PUSHER_ID=app-id 19 | PUSHER_KEY=app-key 20 | PUSHER_SECRET=app-secret 21 | PUSHER_CLUSTER=cluster 22 | ``` 23 | 24 | > **Note**: ensure to replace the placeholder values with your pusher `appId`, `key`, `cluster` and `secret`. 25 | 26 | - Clone the repo 27 | - Enter the project folder 28 | - Run `yarn` or `npm i` 29 | - Start server by running `node server` 30 | - Run `yarn serve` to start the application 31 | 32 | 33 | ## Built With 34 | 35 | - [Vue](https://vuejs.org/) 36 | - [Pusher](https://pusher.com) 37 | - [Express](https://expressjs.com/) 38 | - [Vue-FullCalendar](https://github.com/Wanderxx/vue-fullcalendar) 39 | - [DotEnv](https://www.npmjs.com/package/dotenv) 40 | - [VueJs-Datepicker](https://github.com/charliekassel/vuejs-datepicker) 41 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | '@vue/app' 4 | ] 5 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "realtime-events", 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 | "body-parser": "^1.18.3", 12 | "date-fns": "^1.29.0", 13 | "dotenv": "^6.0.0", 14 | "express": "^4.16.3", 15 | "pusher": "^2.0.1", 16 | "pusher-js": "^4.2.2", 17 | "vue": "^2.5.16", 18 | "vue-fullcalendar": "^1.0.9", 19 | "vuejs-datepicker": "^1.5.2" 20 | }, 21 | "devDependencies": { 22 | "@vue/cli-plugin-babel": "^3.0.0-rc.3", 23 | "@vue/cli-plugin-eslint": "^3.0.0-rc.3", 24 | "@vue/cli-service": "^3.0.0-rc.3", 25 | "vue-template-compiler": "^2.5.16" 26 | }, 27 | "eslintConfig": { 28 | "root": true, 29 | "env": { 30 | "node": true 31 | }, 32 | "extends": [ 33 | "plugin:vue/essential", 34 | "eslint:recommended" 35 | ], 36 | "rules": {}, 37 | "parserOptions": { 38 | "parser": "babel-eslint" 39 | } 40 | }, 41 | "postcss": { 42 | "plugins": { 43 | "autoprefixer": {} 44 | } 45 | }, 46 | "browserslist": [ 47 | "> 1%", 48 | "last 2 versions", 49 | "not ie <= 8" 50 | ] 51 | } 52 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackAfro/vue-event-scheduler/9d081ced84af736be1e53e0307c0bf307c45eea5/public/favicon.ico -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | realtime-events 9 | 10 | 11 | 14 |
15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /server.js: -------------------------------------------------------------------------------- 1 | require('dotenv').config(); 2 | const express = require('express'); 3 | const bodyParser = require('body-parser'); 4 | const Pusher = require('pusher'); 5 | 6 | const app = express(); 7 | const port = process.env.PORT || 4001; 8 | const pusher = new Pusher({ 9 | appId: process.env.PUSHER_APP_ID, 10 | key: process.env.PUSHER_KEY, 11 | secret: process.env.PUSHER_SECRET, 12 | cluster: process.env.PUSHER_CLUSTER, 13 | }); 14 | 15 | app.use(bodyParser.json()); 16 | app.use(bodyParser.urlencoded({ extended: false })); 17 | app.use((req, res, next) => { 18 | res.header('Access-Control-Allow-Origin', '*'); 19 | res.header( 20 | 'Access-Control-Allow-Headers', 21 | 'Origin, X-Requested-With, Content-Type, Accept' 22 | ); 23 | next(); 24 | }); 25 | 26 | 27 | app.post('/schedule', (req, res) => { 28 | const {body} = req; 29 | const data = { 30 | ...body, 31 | // set the selected property of the body to true 32 | }; 33 | // trigger a new-entry event on the vote-channel 34 | pusher.trigger('schedule', 'new-event', data); 35 | res.json(data); 36 | }); 37 | 38 | app.listen(port, () => { 39 | console.log(`Server started on port ${port}`); 40 | }); 41 | -------------------------------------------------------------------------------- /src/App.vue: -------------------------------------------------------------------------------- 1 | 14 | 15 | 58 | 59 | 88 | -------------------------------------------------------------------------------- /src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackAfro/vue-event-scheduler/9d081ced84af736be1e53e0307c0bf307c45eea5/src/assets/logo.png -------------------------------------------------------------------------------- /src/components/Calendar.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 16 | 17 | 18 | 47 | -------------------------------------------------------------------------------- /src/components/ColorPicker.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 26 | 27 | 67 | -------------------------------------------------------------------------------- /src/components/EventForm.vue: -------------------------------------------------------------------------------- 1 | 23 | 24 | 25 | 89 | 90 | 91 | 143 | -------------------------------------------------------------------------------- /src/components/HelloWorld.vue: -------------------------------------------------------------------------------- 1 | 31 | 32 | 40 | 41 | 42 | 58 | -------------------------------------------------------------------------------- /src/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './App.vue' 3 | 4 | Vue.config.productionTip = false 5 | 6 | new Vue({ 7 | render: h => h(App) 8 | }).$mount('#app') 9 | --------------------------------------------------------------------------------