Fix jwt-token
This commit is contained in:
@@ -17,6 +17,7 @@ const { initializeHealthService } = require('./routes/deviceHealth');
|
||||
const seedDatabase = require('./seedDatabase');
|
||||
const errorHandler = require('./middleware/errorHandler');
|
||||
const { apiDebugMiddleware } = require('./utils/apiDebugLogger');
|
||||
const IPRestrictionMiddleware = require('./middleware/ip-restriction');
|
||||
|
||||
const app = express();
|
||||
|
||||
@@ -79,6 +80,10 @@ if (process.env.API_DEBUG === 'true') {
|
||||
|
||||
app.use('/api/', limiter);
|
||||
|
||||
// IP Restriction middleware (before routes)
|
||||
const ipRestriction = new IPRestrictionMiddleware();
|
||||
app.use((req, res, next) => ipRestriction.checkIPRestriction(req, res, next));
|
||||
|
||||
// Make io available to routes
|
||||
app.use((req, res, next) => {
|
||||
req.io = io;
|
||||
|
||||
Reference in New Issue
Block a user