π§ A simple Node.js and Express.js server for sending email notifications from Rohit's portfolio website.
π§ Email Notifications: Sends email notifications to users who contact Rohit through the portfolio site, with notification of message to Rohit.
π API Key Protection: Protects the email sending functionality with API key verification to ensure security.
- Node.js, nodemon and npm installed on your machine.
- Clone this repository to your local machine.
git clone https://github.com/rohitvpatil0810/portfolio-mail-server.git
-
Navigate to the project directory.
cd rohit-portfolio-email-server
-
Install the project dependenceies.
-
Set up your environment variables by creating a
.env
file with the following:[email protected] [email protected] EMAIL_PASSWORD=your_email_password API_KEY=your_api_key_here
-
Start the server.
npm run dev
-
The server will be running on
http://localhost:5000
.
To send an email, make a POST request to the /email/send-notification
endpoint with the required data and the API key in the headers.
Example using cURL:
curl -X POST -H "Content-Type: application/json" -H "x-api-key: your_api_key_here" -d '{
"name": "name_of_messager",
"email": "email_of_messager",
"message": "message_of_messager"
}' http://localhost:3000//email/emailsend-notification