From 6bffde997b1635b8c4b66557347609c278e5e229 Mon Sep 17 00:00:00 2001 From: Lavish Kumar <70912602+Lavish883@users.noreply.github.com> Date: Tue, 9 Jan 2024 04:36:49 +0000 Subject: [PATCH] update for prod --- index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/index.js b/index.js index d075d5e..558fbae 100644 --- a/index.js +++ b/index.js @@ -17,6 +17,9 @@ mongoose.set('strictQuery', false); mongoose.connect(dbURI, { useNewUrlParser: true, useUnifiedTopology: true }) // set up the server +if (process.env.PRODUCTION){ + app.set('trust proxy', 1); +} app.set('view engine', 'pug'); app.use(express.static('public')) // max size of the file is 5mb @@ -80,6 +83,7 @@ app.post('/test/saveLogoImage', rateLimiter, createFormFuctions.saveLogoImage); app.post('/formMaker/sendCodeEmail', rateLimiter ,createFormFuctions.sendCodeEmail); app.post('/formMaker/confirmEmailWithCode', rateLimiter, createFormFuctions.confirmEmailWithCode); app.post('/formMaker/passwordReset', rateLimiter, createFormFuctions.passwordReset); +app.get('/ip', (request, response) => response.send(request.ip)) // api routes app.post('/api/addUsertoFormMaker', [rateLimiter, apiFunctions.checkAPI_KEY], apiFunctions.addUsertoFormMaker);