This repository contains the Node server code used to handle form submissions from my personal portfolio page kdshea.com. The server receives data from my consultation form and sends it to me as an email. This setup allows me to collect and process user input from my portfolio website.
- The server is built using Express, a fast and minimalist web framework for Node.js.
- CORS middleware is used to enable Cross-Origin Resource Sharing, allowing requests from different domains.
- The server utilizes the
dotenv
package to load environment variables from a.env
file. - Nodemailer is used to send email notifications using the Gmail service.
- When a form submission is received at the
/submit-form
endpoint, the server extracts the form data and sends it as an email to the specified recipient. - Success or failure messages are sent back as a response to the client.
Before running the server, make sure to set up the following environment variables in a .env
file:
GMAIL_USER
: Your Gmail account username or email address.PASSWORD
: The app password generated for your Gmail account.
Note: To generate an app password, follow these steps:
- Go to your Gmail account settings.
- Navigate to the "Security" section.
- Find the "App Passwords" option.
- Generate a new app password for your Node server.
- Copy the generated password and use it as the
PASSWORD
environment variable.
- Install the required dependencies by running
npm install
. - Set up the environment variables in a
.env
file. - Run the server using
node server.js
. - The server will start running on the specified port (referenced in
consts.js
).
The server exposes a single endpoint:
POST /submit-form
: Receives form data and sends it as an email to the specified recipient. The following fields are expected in the request body:name
,company
,email
,currentWebsite
,helpWith
,projectDetails
,howDidYouHear
.
I'm a freelance full stack developer with a passion for crafting innovative web solutions. With expertise in both front-end and back-end technologies, I have successfully delivered a wide range of projects, including web applications, RESTful APIs, and database management. I continually strive to solve complex problems and provide efficient, user-friendly solutions.
If you have any questions or would like to discuss potential opportunities, please feel free to reach out to me. You can contact me through the following channels:
Take a look at other projects that I have in my own portfolio: