mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 10:34:17 +00:00
25 lines
577 B
JavaScript
Executable File
25 lines
577 B
JavaScript
Executable File
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({
|
|
origin: "*",
|
|
methods: "GET,HEAD,PUT,PATCH,POST,DELETE",
|
|
preflightContinue: true,
|
|
optionsSuccessStatus: 204
|
|
}))
|
|
|
|
app.use(express.static(path.join(__dirname, "dist")))
|
|
|
|
app.get("*", function (req, res) {
|
|
res.sendFile(path.join(__dirname, "dist", "index.html"))
|
|
})
|
|
|
|
app.listen(portListen)
|
|
|
|
console.log(`🌐 Listening app in port [${portListen}]`) |