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:
5
app.js
5
app.js
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user