mirror of
https://github.com/DeNNiiInc/Web-Page-Performance-Test.git
synced 2026-04-17 20:05:58 +00:00
- Added Express server with Git info API endpoint - Created automated deployment scripts (systemd-based, not PM2) - Implemented 5-minute auto-sync with GitHub - Enhanced .gitignore with 200+ credential protection patterns - Added Git version badge to UI footer - Created comprehensive deployment documentation - Added TurnKey Nginx fix for default control panel issue - Included security verification tools All credentials protected and verified safe for deployment.
43 lines
1.1 KiB
JavaScript
43 lines
1.1 KiB
JavaScript
const express = require("express");
|
|
const path = require("path");
|
|
const fs = require("fs");
|
|
const { exec } = require("child_process");
|
|
|
|
const app = express();
|
|
const PORT = process.env.PORT || 3000;
|
|
|
|
// Serve static files
|
|
app.use(express.static(__dirname));
|
|
|
|
// API endpoint to get Git commit info
|
|
app.get("/api/git-info", (req, res) => {
|
|
exec('git log -1 --format="%H|%cr"', (error, stdout, stderr) => {
|
|
if (error) {
|
|
console.error("Error getting git info:", error);
|
|
return res.json({
|
|
commitId: "unknown",
|
|
commitAge: "unknown",
|
|
error: true,
|
|
});
|
|
}
|
|
|
|
const [commitId, commitAge] = stdout.trim().split("|");
|
|
res.json({
|
|
commitId: commitId.substring(0, 7),
|
|
commitAge: commitAge,
|
|
error: false,
|
|
});
|
|
});
|
|
});
|
|
|
|
// Serve index.html for all other routes
|
|
app.get("*", (req, res) => {
|
|
res.sendFile(path.join(__dirname, "index.html"));
|
|
});
|
|
|
|
app.listen(PORT, () => {
|
|
console.log(`🚀 Server running on port ${PORT}`);
|
|
console.log(`📁 Serving files from: ${__dirname}`);
|
|
console.log(`🌐 Environment: ${process.env.NODE_ENV || "development"}`);
|
|
});
|