Fix admin API to serve admin.html on root route

- Updated server.js to serve admin.html on GET /
- Fixed path to admin.html in Docker container
- Admin panel now accessible at http://<ip>:3000
This commit is contained in:
capitano
2026-03-19 09:06:02 +01:00
parent 0258e837d4
commit 1e8342d406
2 changed files with 10 additions and 3 deletions

View File

@@ -2,11 +2,12 @@ FROM node:18-alpine
WORKDIR /app
COPY package*.json ./
COPY backend/package*.json ./
RUN npm install --production
COPY server.js ./server.js
COPY data/apps.json ./data/apps.json
COPY backend/server.js ./server.js
COPY backend/data/apps.json ./data/apps.json
COPY frontend/admin.html ./admin.html
ENV PORT=3000
EXPOSE 3000

View File

@@ -8,6 +8,12 @@ const PORT = process.env.PORT || 3000;
const JWT_SECRET = process.env.JWT_SECRET || 'fallback-secret-key';
const APPS_FILE = path.join(__dirname, 'data', 'apps.json');
// Serve admin frontend
const adminPath = path.join(__dirname, 'admin.html');
app.get('/', (req, res) => {
res.sendFile(adminPath);
});
app.use(express.json());
app.use((req, res, next) => {
res.setHeader('Access-Control-Allow-Origin', '*');