chore: add example env file, improve documentation and code comments

This commit is contained in:
2025-08-23 00:27:01 -05:00
parent 5a29578c7d
commit cae3c892be
6 changed files with 35 additions and 25 deletions

View File

@@ -1,12 +1,10 @@
// contactController.js
module.exports = (pool, transporter) => {
// The main function that handles the form submission
const submitForm = async (req, res) => {
const { firstName, lastName, organization, email, phone, contactMethod, message } = req.body;
try {
// 1. Save submission to the database
const result = await pool.query(
`INSERT INTO submissions(first_name, last_name, organization, email, phone, contact_method, message)
VALUES($1, $2, $3, $4, $5, $6, $7) RETURNING *`,
@@ -15,7 +13,6 @@ module.exports = (pool, transporter) => {
console.log('Successfully saved submission to the database:', result.rows[0]);
// 2. Send the email notification
const mailOptions = {
from: `"Contact Form" <contact@dlseitz.dev>`,
to: process.env.EMAIL_RCPT,