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
{ | |
"name": "socket-io-playground", | |
"version": "1.0.0", | |
"main": "index.js", | |
"repository": "[email protected]:klogic/socket-io-playground.git", | |
"author": "Narongsak Keawmanee <[email protected]>", | |
"license": "MIT", | |
"scripts": { | |
"dev": "concurrently \"tsc -w\" \"nodemon dist/app.js\"" | |
}, |
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
{ | |
"compilerOptions": { | |
"target": "es2017", | |
"module": "commonjs", | |
"baseUrl": ".", | |
"outDir": "./dist", | |
"jsx": "react", | |
"strict": true, | |
"noImplicitAny": true, | |
"allowSyntheticDefaultImports": true, |
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 axios from 'axios'; | |
import express, { Request, Response } from 'express'; | |
import ioserver, { Socket } from 'socket.io'; | |
import ioclient from 'socket.io-client'; | |
const app = express(); | |
const server = require('http').Server(app); | |
const port = 3000; | |
const io = ioserver(server); | |
app.get('/', (req: Request, res: Response) => { |
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 { Response, Request } from "express"; | |
const express = require("express"); | |
const app = express(); | |
const port = 3000; | |
app.get("/", (req: Request, res: Response) => res.send("Hello World!")); | |
app.listen(port, () => console.log(`Example app listening on port ${port}!`)); |
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 { Response, Request } from "express"; | |
const kue = require("kue"); | |
const express = require("express"); | |
const app = express(); | |
const port = 3000; | |
app.get("/", (req: Request, res: Response) => { | |
res.send("Hello World!"); | |
}); | |
app.use("/kue-api/", kue.app); |
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 { Response, Request } from "express"; | |
const kue = require("kue"); | |
const express = require("express"); | |
const app = express(); | |
const port = 3000; | |
const axios = require("axios"); | |
const queue = kue.createQueue(); | |
app.get("/", (req: Request, res: Response) => { |
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 { Response, Request } from "express"; | |
import { Job, DoneCallback } from "kue"; | |
import axios from "axios"; | |
const kue = require("kue"); | |
const express = require("express"); | |
const app = express(); | |
const port = 3000; | |
const queue = kue.createQueue(); |
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
Host o.Development.server.digitalocean | |
User root | |
Hostname 209.97.171.74 |
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
from datetime import datetime | |
from random import randrange | |
from sqlalchemy import DECIMAL, Column, DateTime, Integer, MetaData, String | |
from sqlalchemy.ext.declarative import declarative_base | |
from sqlalchemy.orm import relationship, sessionmaker | |
from connection import conn | |
Base = declarative_base() |
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
require("dotenv").config(); | |
const amqp = require("amqplib/callback_api"); | |
amqp.connect("amqp://" + process.env.RABBITMQ_URL, function(err, conn) { | |
if (err) { | |
console.log("error", err); | |
} else { | |
const url = "https://jsonplaceholder.typicode.com"; | |
conn.createChannel(function(err, ch) { | |
for (let postIndex = 1; postIndex < 15; postIndex++) { |