cors issues
This commit is contained in:
@@ -2,7 +2,7 @@ const express = require('express')
|
|||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
|
|
||||||
const app = express()
|
const app = express()
|
||||||
//const cors = require("cors");
|
const cors = require("cors");
|
||||||
|
|
||||||
const videoFileMap={
|
const videoFileMap={
|
||||||
'cdn':'videos/v1.mp4',
|
'cdn':'videos/v1.mp4',
|
||||||
@@ -10,8 +10,26 @@ const videoFileMap={
|
|||||||
'get-post':'videos/v3.mp4',
|
'get-post':'videos/v3.mp4',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var corsOptions = {
|
||||||
|
origin: ['http://localhost:3000',
|
||||||
|
'http://localhost:3040',
|
||||||
|
'http://10.0.0.248:3000',
|
||||||
|
'https://10.0.0.248:3000',
|
||||||
|
'http://localhost:9082/',
|
||||||
|
'http://10.204.5.100:9082',
|
||||||
|
'http://localhost:9083/',
|
||||||
|
'https://dev-users.wrenchboard.com/',
|
||||||
|
'https://dev-users.wrenchboard.com:3000/',
|
||||||
|
'https://users.wrenchboard.com/',
|
||||||
|
'https://www.wrenchboard.com/',
|
||||||
|
'https://www.wrenchboard.ng/',
|
||||||
|
'https://dev-www.wrenchboard.com/',
|
||||||
|
'http://76.209.103.227:30040'],
|
||||||
|
optionsSuccessStatus: 200 // some legacy browsers (IE11, various SmartTVs) choke on 204
|
||||||
|
}
|
||||||
|
|
||||||
app.get('/videos/:filename',(req, res)=>{
|
|
||||||
|
app.get('/videos/:filename',cors(corsOptions), (req, res)=>{
|
||||||
const fileName = req.params.filename;
|
const fileName = req.params.filename;
|
||||||
const filePath = videoFileMap[fileName]
|
const filePath = videoFileMap[fileName]
|
||||||
if(!filePath){
|
if(!filePath){
|
||||||
|
|||||||
Reference in New Issue
Block a user