-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f858cd6
commit 2b834c1
Showing
1 changed file
with
19 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,22 @@ | ||
import express from "express"; | ||
import ViteExpress from "vite-express"; | ||
// import ViteExpress from "vite-express"; | ||
import { fileURLToPath } from "url"; | ||
import { dirname } from "path"; | ||
|
||
const __filename = fileURLToPath(import.meta.url); | ||
const __dirname = dirname(__filename); | ||
const app = express(); | ||
ViteExpress.listen(app, 3000, () => console.log("Server is listening...")); | ||
const PORT = 3000; | ||
// ViteExpress.listen(app, 3000, () => console.log("Server is listening...")); | ||
app.listen(PORT, function (err) { | ||
if (err) console.log("Error in server setup"); | ||
console.log("Server listening on Port", PORT); | ||
}); | ||
|
||
app.use("/assets", express.static(__dirname + "/dist/assets")); | ||
app.use("/img", express.static(__dirname + "/dist/img")); | ||
app.use("/scss", express.static(__dirname + "/dist/scss")); | ||
|
||
app.get("*", function (req, res) { | ||
res.sendFile("dist/index.html", { root: __dirname }); | ||
}); |