diff --git a/controllers/contactController.js b/controllers/contactController.js index e504b0c..863c4c2 100644 --- a/controllers/contactController.js +++ b/controllers/contactController.js @@ -1,3 +1,4 @@ +// contactController.js module.exports = (pool, transporter) => { // The main function that handles the form submission diff --git a/middleware/securityMw.js b/middleware/securityMw.js index 8474290..ee611ab 100644 --- a/middleware/securityMw.js +++ b/middleware/securityMw.js @@ -1,3 +1,4 @@ +// securityMw.js require('dotenv').config(); const fetch = require('node-fetch'); diff --git a/routes/contactRoutes.js b/routes/contactRoutes.js index a4354e9..62f24c4 100644 --- a/routes/contactRoutes.js +++ b/routes/contactRoutes.js @@ -1,4 +1,4 @@ -// The entire module is now a function that accepts 'contactController' and security middleware as an argument. +// contactRoutes.js module.exports = (contactController, securityMw) => { const express = require('express'); const router = express.Router(); @@ -13,7 +13,7 @@ module.exports = (contactController, securityMw) => { }); // Define the route for form submissions with all middleware - router.post('/', + router.post('/submit-form', apiLimiter, // The security middleware is now a separate step, // containing both the honeypot check and hCaptcha verification. diff --git a/server.js b/server.js index cc13974..2fbc585 100644 --- a/server.js +++ b/server.js @@ -1,3 +1,4 @@ +//server.js const nodemailer = require('nodemailer'); const express = require('express'); const path = require('path');