DocFast MVP: HTML/Markdown to PDF API with invoice templates

This commit is contained in:
Hoid 2026-02-14 12:30:17 +00:00
parent 789b3bfeeb
commit 77ec1c5524
24 changed files with 5010 additions and 22 deletions

View file

@ -0,0 +1,17 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.authMiddleware = authMiddleware;
const API_KEYS = new Set((process.env.API_KEYS || "test-key-123").split(",").map((k) => k.trim()));
function authMiddleware(req, res, next) {
const header = req.headers.authorization;
if (!header?.startsWith("Bearer ")) {
res.status(401).json({ error: "Missing API key. Use: Authorization: Bearer <key>" });
return;
}
const key = header.slice(7);
if (!API_KEYS.has(key)) {
res.status(403).json({ error: "Invalid API key" });
return;
}
next();
}