- aggiunto componenti per Home Template... ma ancora da provare
- sistemato catprods - Sistemato menu
This commit is contained in:
@@ -21,6 +21,12 @@ var http = require('http');
|
||||
const WebSocket = require('ws');
|
||||
const { spawn } = require('child_process');
|
||||
|
||||
const helmet = require('helmet');
|
||||
const morgan = require('morgan');
|
||||
const apiRouter = require('./routes/index-aa');
|
||||
const { notFound, errorHandler } = require('./middleware/error');
|
||||
const rateLimit = require('./middleware/rateLimit').rateLimit;
|
||||
|
||||
const NUOVO_METODO_TEST = true;
|
||||
|
||||
const METODO_MULTI_CORS = true;
|
||||
@@ -298,10 +304,7 @@ connectToDatabase(connectionUrl, options)
|
||||
} else {
|
||||
let msgerr = '❌ ERRORE! la decrittazione non funziona! ';
|
||||
console.error(msgerr);
|
||||
await telegrambot.sendMsgTelegramToTheAdminAllSites(
|
||||
msgerr,
|
||||
false
|
||||
);
|
||||
await telegrambot.sendMsgTelegramToTheAdminAllSites(msgerr, false);
|
||||
}
|
||||
|
||||
await inizia();
|
||||
@@ -867,9 +870,21 @@ connectToDatabase(connectionUrl, options)
|
||||
}
|
||||
|
||||
function setupMiddleware(app, corsOptions, isDebug = false) {
|
||||
app.use(helmet());
|
||||
app.use(cors(corsOptions));
|
||||
app.set('trust proxy', true);
|
||||
app.use(express.json());
|
||||
|
||||
app.use(morgan('dev'));
|
||||
app.use(rateLimit);
|
||||
|
||||
app.get('/health', (_req, res) => res.json({ ok: true }));
|
||||
|
||||
app.use('/apinew', apiRouter);
|
||||
|
||||
// app.use(notFound);
|
||||
app.use(errorHandler);
|
||||
|
||||
app.options('*', cors(corsOptions));
|
||||
|
||||
if (isDebug) {
|
||||
@@ -1058,8 +1073,6 @@ connectToDatabase(connectionUrl, options)
|
||||
process.exit(1); // Termina il processo se non riesce a connettersi
|
||||
});
|
||||
|
||||
function add_numbers(a, b) {
|
||||
|
||||
}
|
||||
function add_numbers(a, b) {}
|
||||
|
||||
module.exports = { app };
|
||||
|
||||
Reference in New Issue
Block a user