Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
andreyshulga1cs committed Feb 11, 2024
1 parent f858cd6 commit 2b834c1
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions server.js
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 });
});

0 comments on commit 2b834c1

Please sign in to comment.