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
const express = require('express'); | |
const app = express(); | |
const path = require('path'); | |
const multer = require('multer'); | |
const sharp = require('sharp'); | |
const port = 3000; | |
app.use('/uploads', express.static(path.join(__dirname, '/uploads'))); |
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 mongoose = require('mongoose'); | |
const bodyParser = require('body-parser'); | |
const redis = require('redis'); | |
const app = express(); | |
app.use(bodyParser.json()); | |
//Redis connection |
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(); | |
const path = require('path'); | |
const multer = require('multer'); | |
const port = 3000; | |
app.use('/uploads', express.static(path.join(__dirname, '/uploads'))); | |
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(); |
NewerOlder