API-Auth dazu

automatisch auf INFLUX schalten, wenn es Chi-ID gibt
zuzsätzlich option db=m zum erzwingen von Moing
Anzeige Mongo/Influx im Datenstrom
This commit is contained in:
2025-11-05 09:47:25 +00:00
parent 6d9d94f2fa
commit bd44740649
9 changed files with 973 additions and 22 deletions

5
app.js
View File

@@ -1,3 +1,4 @@
import 'dotenv/config'
import createError from 'http-errors'
import logger from 'morgan'
import express from 'express'
@@ -19,6 +20,7 @@ import indexRouter from './routes/index.js'
import { apiRouter } from './routes/api.js'
import {fileURLToPath} from "url";
import path from "path";
import { validateApiKey } from './utilities/apiauth.js'
i18next
@@ -42,7 +44,8 @@ app.use(express.urlencoded({ extended: true }))
app.use(cookieParser())
app.use('/', indexRouter)
app.use('/api', apiRouter)
// API-Key-Authentifizierung für alle /api/* Routen
app.use('/api', validateApiKey, apiRouter)
// catch 404 and forward to error handler