This file contains 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 Vuex from 'vuex'; | |
import createPersistedState from 'vuex-persistedstate'; | |
import SecureLS from "secure-ls"; | |
import cart from './modules/cart'; | |
Vue.use(Vuex); | |
const secureLS = new SecureLS({ |
This file contains 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 Vuex from 'vuex'; | |
import createPersistedState from 'vuex-persistedstate'; | |
import cart from './modules/cart'; | |
Vue.use(Vuex); | |
const cartState = createPersistedState({ | |
key: 'cart-persist-state', |
This file contains 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 axios = require('axios'); | |
const readline = require('readline-sync'); | |
class AppClass { | |
constructor(data) { | |
this.data = [...data]; | |
this.pageNumber = 1; | |
this.pageSize = 10; | |
this.tempData = []; | |
this.isSearch = false; |
This file contains 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 express = require('express'); | |
const axios = require('axios'); | |
const router = express.Router(); | |
const app = express(); | |
// Router for /status | |
router.get('/status', | |
(req, res) => { | |
res.json({ |
This file contains 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 amqp = require('amqplib/callback_api') // Import library amqplib | |
amqp.connect('amqp://localhost', (err, conn) => { | |
conn.createChannel((err, ch) => { | |
const q = 'task_queue' // Nama antrian adalah 'task_queue' | |
ch.assertQueue(q, { durable: true }) // Menyatakan antriannya adalah 'task_queue' | |
ch.prefetch(1) | |
console.log(`[*] Waiting for messages in %s. To exit press CTRL+C`, q) | |
/* Menangkap pesan yang dikirimkan RabbitMQ dari antrian */ |
This file contains 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 amqp = require('amqplib/callback_api') // import library amqplib | |
amqp.connect('amqp://localhost', (err, conn) => { | |
conn.createChannel((err, ch) => { | |
const q = 'task_queue' // Nama antrian adalah 'task_queue' | |
const msg = process.argv.slice(2).join(' ') || 'Hello World!' | |
ch.assertQueue(q, { durable: true }) // Membuat antrian 'task_queue' | |
ch.sendToQueue(q, new Buffer(msg), { persistent: true }) // Mengirim pesan tugas ke antrian | |
console.log(`[x] Sent '%s'`, msg) |
This file contains 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 amqp = require('amqplib') // Import library amqp | |
amqp.connect('amqp://localhost') | |
.then(conn=> { | |
return conn.createChannel().then(ch => { | |
const ok = ch.assertQueue('hello', { durable: false }) // Deklarasi antrian | |
ok.then(() => { | |
/* Menangkap pesan yang dikirimkan oleh RabbitMQ */ | |
return ch.consume('hello', msg => console.log('- Received', msg.content.toString()), { noAck: true }) | |
}) |
This file contains 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 amqp = require('amqplib') // Import library amqp | |
amqp.connect('amqp://localhost') | |
.then(conn => { | |
return conn.createChannel().then(ch => { | |
const q = 'hello' // Nama antrian adalah 'hello' | |
const msg = 'Hello world!' // Isi pesan yang dikirim ke RabbitMQ | |
const ok = ch.assertQueue(q, { durable: false }) // Membuat antrian 'hello' | |
return ok.then(() => { |
This file contains 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 csv = require('csvjson') | |
const knex = require('./knex') | |
const fs = require('fs') | |
const file = fs.readFileSync('data.csv', 'utf8') | |
const dataObj = csv.toObject(file) | |
knex.insert(dataObj) | |
.into('employees') | |
.then(() => { |
NewerOlder