feat: implement secure Express API server for markdown content management
This commit is contained in:
parent
165c473915
commit
321cbe8789
@ -22,6 +22,8 @@ app.use(cors());
|
||||
app.use(bodyParser.json({ limit: '1mb' })); // Added body parser size limit
|
||||
|
||||
// Basic authentication - only if credentials are set
|
||||
// Commenting out API-level Basic Auth as Caddy reverse proxy will handle it.
|
||||
/*
|
||||
if (USERNAME && PASSWORD) {
|
||||
app.use(basicAuth({
|
||||
users: { [USERNAME]: PASSWORD },
|
||||
@ -35,6 +37,7 @@ if (USERNAME && PASSWORD) {
|
||||
// A better approach for production would be to throw an error and exit:
|
||||
// throw new Error('Admin credentials not configured');
|
||||
}
|
||||
*/
|
||||
|
||||
// Helper function for filename validation and path construction
|
||||
function getSafeFilePath(filename) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user