23 lines
591 B
JavaScript
23 lines
591 B
JavaScript
const express = require("express");
|
|
const path = require("path");
|
|
const fs = require("fs");
|
|
|
|
const app = express();
|
|
const PORT = 4000;
|
|
|
|
// Serve lista app da apps.json
|
|
app.get("/apps", (req, res) => {
|
|
const apps = JSON.parse(fs.readFileSync(path.join(__dirname, "apps.json")));
|
|
res.json(apps);
|
|
});
|
|
|
|
// Serve frontend build
|
|
app.use(express.static(path.join(__dirname, "../frontend/dist")));
|
|
|
|
app.get("*", (req, res) => {
|
|
res.sendFile(path.join(__dirname, "../frontend/dist/index.html"));
|
|
});
|
|
|
|
app.listen(PORT, () => {
|
|
console.log(`Dashboard running on http://localhost:${PORT}`);
|
|
});
|