forked from Kshitiz1403/Zoom-Recording-Downloader
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathserver.js
39 lines (27 loc) · 1.17 KB
/
server.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import * as dotenv from 'dotenv' // see https://github.com/motdotla/dotenv#how-do-i-use-dotenv-with-import
dotenv.config()
import express from 'express'
import { getToken } from './zoomAPI.js'
import download, { getFilesForId, getStatus } from './downloader.js'
import JSONdb from 'simple-json-db'
import cors from 'cors'
import fs from 'fs'
import path from 'path'
export const db = new JSONdb("./store.json");
export const redirect_URL = "https://zoom.kshitizagrawal.in";
export const downloadDirectory = "./downloads"
export const zipsDirectory = "./zips"
if (!fs.existsSync(downloadDirectory)) fs.mkdirSync(downloadDirectory)
if (!fs.existsSync(zipsDirectory)) fs.mkdirSync(zipsDirectory)
const app = express();
app.use(express.json()) // for json
app.use(express.urlencoded({ extended: true })) // for form data
app.use(cors())
app.use(express.static(zipsDirectory))
const __dirname = path.resolve()
app.get('/status/*', (req, res) => res.sendFile(path.join(__dirname, "index.html")))
app.get('/', getToken);
app.post('/download', download);
app.get('/download/:id', getFilesForId)
app.get('/api/status/:id', getStatus)
app.listen('7229', () => console.log("Server listening on 7229"));