Simple Node.js REST API to handle contact form submissions. Developed as part of a tutorial.
The goal of this app is to demonstrate:
Requirements:
- A free Mailgun account with a verified domain
# Clone the repo
git clone git@github.com:jlengstorf/mailgun-contact-form-api.git
# Move into the newly-cloned directory
cd mailgun-contact-form-api
# Install dependencies
npm install
# Copy the `.env.example`
cp .env.example .env
# Add your Mailgun info and email address to `.env`
vim .env
# Start the app
npm start
Visit http://localhost:5000/status in your browser to verify that the app is running — it should display:
{"statusCode":200,"message":"API is running."}
Once the app is running, you can send a test message by copy-pasting the following command into the command line.
curl -H "Content-Type: application/json" -X POST -d '{"name":"cURL Test","email":"curl@example.com", "message":"Sent via curl!\n\nNeat, right?"}' http://localhost:5000/submit