The contact form uses a simple Express server to send emails via Nodemailer.
-
Install dependencies:
npm install
-
Configure email settings: Create a
.envfile in the root directory with:EMAIL_USER=your-email@gmail.com EMAIL_PASS=your-app-password PORT=3001 -
For Gmail users:
- Enable 2-factor authentication
- Generate an "App Password" (not your regular password)
- Use the app password in EMAIL_PASS
-
Start the development server:
npm run dev
This will start both the frontend (Vite) and backend (Express) servers.
- Frontend sends form data to
http://localhost:3001/api/contact(dev) or/api/contact(prod) - Backend validates the data and sends an email to
contact@aswincloud.com - Form shows success/error messages based on the response
For production, you'll need to:
- Deploy the Express server (server.js) to your hosting platform
- Set up environment variables on your hosting platform
- Update the frontend API URL to point to your deployed server