added cors to server

This commit is contained in:
srgooglo 2022-06-03 19:34:16 +02:00
parent c3ec2845f1
commit 394e327430
2 changed files with 5 additions and 0 deletions

View File

@ -86,6 +86,7 @@
"cross-env": "^7.0.3",
"express": "^4.17.1",
"typescript": "^4.3.5",
"cors": "2.8.5",
"vite": "2.9.9"
}
}

View File

@ -1,10 +1,14 @@
const express = require("express")
const path = require("path")
const cors = require("cors")
const app = express()
const portFromArgs = process.argv[2]
let portListen = portFromArgs ? portFromArgs : 9000
app.use(cors())
app.use(express.static(path.join(__dirname, "dist")))
app.get("*", function (req, res) {