workcraft-js
Version:
Node module for Workcraft Workers
23 lines (17 loc) • 582 B
JavaScript
import express from "express";
import path from "path";
import { fileURLToPath } from "url";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const app = express();
// Serve static files from 'public' directory
app.use(express.static("public"));
app.use("/node_modules", express.static("node_modules"));
// Serve index.html
app.get("/", (req, res) => {
res.sendFile(path.join(__dirname, "public", "index.html"));
});
const PORT = 3000;
app.listen(PORT, () => {
console.log(`Server is running on http://localhost:${PORT}`);
});