This commit is contained in:
+2
-2
@@ -33,6 +33,7 @@ const transporter = nodemailer.createTransport({
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Endpoint do Formulário de Contacto (Com Recetor Dinâmico)
|
||||
app.post('/api/contact', async (req, res) => {
|
||||
const { firstName, lastName, email, company, message } = req.body;
|
||||
@@ -84,11 +85,10 @@ app.post('/api/contact', async (req, res) => {
|
||||
res.status(500).json({ error: 'Internal server error. Could not send confirmation email.' });
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = { app, transporter };
|
||||
// Export the app for testing, but only listen if run directly
|
||||
if (require.main === module) {
|
||||
app.listen(PORT, () => {
|
||||
console.log(`[Apex Server] Running on port ${PORT}`);
|
||||
});
|
||||
}
|
||||
module.exports = app;
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
const request = require('supertest');
|
||||
const app = require('../backend/server');// Adjust the path if server.js is in another folder
|
||||
const { app, transporter } = require('../backend/server');
|
||||
const nodemailer = require('nodemailer');
|
||||
|
||||
// ==========================================
|
||||
|
||||
Reference in New Issue
Block a user