This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <template> | |
| <div id="app"> | |
| <div id="nav"> | |
| <router-link to="/">Home</router-link> | | |
| <!-- <router-link to="/about">About</router-link> --> | |
| <!-- <button @click="toAbout">click to about</button> --> | |
| <br /> | |
| | | |
| <router-link :to="{ name: 'users', params: { name: 'tar' } }" | |
| >Tar users</router-link |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <template> | |
| <div> | |
| Admin Dashboard | |
| </div> | |
| </template> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <template> | |
| <div> | |
| Admin Dashboard | |
| </div> | |
| </template> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <template> | |
| <div class="about"> | |
| <h1>This is an about page</h1> | |
| </div> | |
| </template> | |
| <script> | |
| export default { | |
| beforeRouteLeave(to, from, next) { | |
| const a = confirm("Do you want to leave ?"); | |
| if (a) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Vue from "vue"; | |
| import Router from "vue-router"; | |
| import Home from "./views/Home.vue"; | |
| import About from "./views/About.vue"; | |
| import About0 from "./views/About0.vue"; | |
| Vue.use(Router); | |
| const router = new Router({ | |
| mode: "history", | |
| base: process.env.BASE_URL, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const event = require('events'); | |
| const myEvent = new event.EventEmitter(); | |
| myEvent.on('lordBenz',(dataOne,dataTwo)=>{ | |
| console.log(dataOne); | |
| console.log(dataTwo); | |
| console.log("Listener 1"); | |
| }) | |
| setInterval(()=>{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const event = require('events'); | |
| const mailer = require('./mailer'); | |
| const myEvent = new event.EventEmitter(); | |
| myEvent.on('mailer',mailer); | |
| const route = { | |
| url: "/users", | |
| method: "GET", | |
| handler: ()=>{ | |
| myEvent.emit('mailer') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const fastify = require('fastify')(); | |
| const Websocket = require('ws'); | |
| const wsServer = new Websocket.Server({ | |
| port:3000, | |
| server: fastify.server | |
| }); | |
| fastify.decorate('ws',wsServer); | |
| fastify.ready((err)=>{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <template> | |
| <div id="app"> | |
| <input v-model="message"/> | |
| <button @click="sendMessage">Send message</button> | |
| <ul v-for="(value,index) in listMessages" :key="index"> | |
| <li>{{value}}</li> | |
| </ul> | |
| </div> | |
| </template> |