feat: implement Express API server with CRUD operations for content files

This commit is contained in:
greg 2025-05-24 09:43:28 +02:00
parent 154b47935b
commit df15dc91db

View File

@ -3,7 +3,6 @@ const fs = require('fs/promises');
const path = require('path'); const path = require('path');
const cors = require('cors'); const cors = require('cors');
const bodyParser = require('body-parser'); const bodyParser = require('body-parser');
const basicAuth = require('express-basic-auth');
const app = express(); const app = express();
const PORT = process.env.PORT || 3000; const PORT = process.env.PORT || 3000;
@ -15,13 +14,6 @@ const PASSWORD = process.env.ADMIN_PASSWORD || 'password';
app.use(cors()); app.use(cors());
app.use(bodyParser.json()); app.use(bodyParser.json());
// Basic authentication
app.use(basicAuth({
users: { [USERNAME]: PASSWORD },
challenge: true,
realm: 'Content Admin'
}));
// List all content files // List all content files
app.get('/api/content', async (req, res) => { app.get('/api/content', async (req, res) => {
try { try {