file path and database added
This commit is contained in:
@@ -1,2 +1,3 @@
|
||||
WRENCHJOB_PORT=3000
|
||||
WRENCHJOB_POSTGRE_URL='postgresql://wrenchboard:wrenchboard@10.20.30.60:5432/wrenchboard'
|
||||
COMMON_MEDIA_PATH='/opt/wrenchboard/TEST/COMMON/MEDIA/'
|
||||
@@ -1,11 +1,11 @@
|
||||
const express = require('express')
|
||||
const fs = require('fs')
|
||||
|
||||
const db = require('./app/db')
|
||||
const app = express()
|
||||
const cors = require("cors");
|
||||
|
||||
|
||||
const videoFileMap={
|
||||
const videoFileMap2={
|
||||
'cdn':'videos/v1.mp4',
|
||||
'generate-pass':'videos/v2.mp4',
|
||||
'get-post':'videos/v3.mp4',
|
||||
@@ -20,6 +20,21 @@ const videoFileMap={
|
||||
'tt9':'/opt/wrenchboard/TEST/COMMON/MEDIA/How to Install RabbitMQ Locally with Docker-(1080p60).mp4',
|
||||
}
|
||||
|
||||
const videoFileMap={
|
||||
'cdn':'videos/v1.mp4',
|
||||
'generate-pass':'videos/v2.mp4',
|
||||
'get-post':'videos/v3.mp4',
|
||||
'tt1':'What Is Single Sign-on (SSO)? How It Works-(1080p25).mp4',
|
||||
'tt2':'What is RabbitMQ?-(1080p30).mp4',
|
||||
'tt3':'What is CORS?-(1080p50).mp4',
|
||||
'tt4':'SAML vs OAuth vs OIDC (explained simply!)-(1080p25).mp4',
|
||||
'tt5':'Running RabbitMQ Locally with Docker-(1080p60).mp4',
|
||||
'tt6':'React Proxy | Easiest Fix to CORS Errors-(2160p24).mp4',
|
||||
'tt7':'RabbitMQ Tutorial - Publisher and Consumer program with example in nodeJS-(686p30).mp4',
|
||||
'tt8':'RabbitMQ - RPC with NodeJs (request-reply pattern)-(1080p60).mp4',
|
||||
'tt9':'How to Install RabbitMQ Locally with Docker-(1080p60).mp4',
|
||||
}
|
||||
|
||||
console.log("Finding File");
|
||||
|
||||
var corsOptions = {
|
||||
@@ -32,6 +47,9 @@ app.use(cors(corsOptions));
|
||||
|
||||
app.get('/videos/:filename', (req, res)=>{
|
||||
const fileName = req.params.filename;
|
||||
|
||||
|
||||
|
||||
const filePath = videoFileMap[fileName]
|
||||
if(!filePath){
|
||||
console.log("Finding File Not Found ", filePath);
|
||||
@@ -40,7 +58,9 @@ app.get('/videos/:filename', (req, res)=>{
|
||||
|
||||
console.log("Finding File Found ", filePath);
|
||||
|
||||
const stat = fs.statSync(filePath);
|
||||
const completeFile = process.env.COMMON_MEDIA_PATH + filePath;
|
||||
|
||||
const stat = fs.statSync(completeFile);
|
||||
const fileSize = stat.size;
|
||||
const range = req.headers.range;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user