fix: move health endpoint before auth middleware, add curl to alpine

This commit is contained in:
2026-08-24 11:53:46 +03:00
parent a2cf87e8fd
commit fb2dc49f06
2 changed files with 5 additions and 4 deletions
+1
View File
@@ -1,4 +1,5 @@
FROM node:20-alpine
RUN apk add --no-cache curl
WORKDIR /app
COPY package.json ./
RUN npm install --production
+4 -4
View File
@@ -65,6 +65,10 @@ const smtp = new SMTPServer({
const app = express();
app.get("/health", (_req, res) => {
res.json({ status: "ok", stored: store.size });
});
app.use((req, res, next) => {
if (API_KEY && req.headers["x-api-key"] !== API_KEY) {
return res.status(401).json({ error: "unauthorized" });
@@ -72,10 +76,6 @@ app.use((req, res, next) => {
next();
});
app.get("/health", (_req, res) => {
res.json({ status: "ok", stored: store.size });
});
app.get("/mail/:address", (req, res) => {
const addr = req.params.address.toLowerCase();
const mails = store.get(addr) || [];