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 { config } from "dotenv"; | |
config(); | |
import http from "http"; | |
import express, { Request, Response } from "express"; | |
import { Server } from "socket.io"; | |
import mongoose from "mongoose"; | |
import cors from "cors"; | |
import path from "path"; | |
import morgan from "morgan"; | |
import { SocketInit } from "./socket.io"; |
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 axios from "axios"; | |
import React from "react"; | |
const FileDownload = require("js-file-download"); | |
export default function VideoDownloader(props) { | |
console.log(props); | |
const { video } = props; | |
const { _id, title, thumbnail } = video; | |
const downloadVideo = async (event) => { |
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 React, { useEffect, useState } from "react"; | |
import axios from "axios"; | |
import toast, { Toaster } from "react-hot-toast"; | |
import { io } from "socket.io-client"; | |
import Videos from "./Videos"; | |
const notify = (msg, { success }) => { | |
if (success) { | |
return toast.success(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
import axios from 'axios'; | |
const response = await axios('https://quote-garden.herokuapp.com/api/v2/quotes/random'); | |
console.log(response.data); |
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
{ | |
"name": "async-await-top", | |
"version": "1.0.0", | |
"description": "", | |
"main": "top-level-async-await.js", | |
"type": "module", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"author": "", |
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 { Worker, isMainThread, parentPort } = require('worker_threads'); | |
if (isMainThread) { | |
console.log('Starting the main thread'); | |
const worker = new Worker(__filename); | |
worker.on('message', (msg) => { | |
console.log(`Worker: ${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
console.log('Starting the main thread'); | |
console.log('Getting started'); | |
wasteTime(); | |
console.log('In the middle'); | |
wasteTime(); |
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
worker_processes 1; | |
http { | |
upstream nodejs-backend { | |
server localhost:4000; | |
} | |
include mime.types; |
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 app = express(); | |
app.get('/hi', (req, res) => { | |
res.send('Hi! Reverse Proxy'); | |
}); | |
app.listen(4000, () => console.log('Server running on 4000')); |
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 app = express(); | |
app.get('/hi', (req, res) => { | |
res.send('Hi! Reverse Proxy'); | |
}); | |
app.listen(4000, () => console.log('Server running on 4000')); |
NewerOlder