aa
This commit is contained in:
@@ -23,8 +23,10 @@ const config = {
|
|||||||
|
|
||||||
// Middleware per verificare l'API Key
|
// Middleware per verificare l'API Key
|
||||||
app.use((req, res, next) => {
|
app.use((req, res, next) => {
|
||||||
|
console.log('Middleware per verificare l\'API Key...')
|
||||||
const apiKey = req.headers['x-api-key'];
|
const apiKey = req.headers['x-api-key'];
|
||||||
if (apiKey !== API_KEY) {
|
if (apiKey !== API_KEY) {
|
||||||
|
console.error('APIKEY NON CORRETTA !')
|
||||||
return res.status(403).json({ error: 'Accesso negato' });
|
return res.status(403).json({ error: 'Accesso negato' });
|
||||||
}
|
}
|
||||||
next();
|
next();
|
||||||
|
|||||||
Reference in New Issue
Block a user