tarikmehic / mailgun-contact-form-api

Simple Node.js REST API to handle contact form submissions. Developed as part of a tutorial.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Mailgun Contact Form API

Build Status Code Climate Test Coverage Issue Count

Simple Node.js REST API to handle contact form submissions. Developed as part of a tutorial.

The goal of this app is to demonstrate:

  • Building a simple API using hapi
  • Writing tests using Jasmine
  • Sending messages using Mailgun

Quick Start

Requirements:

# 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."}

Send a Test Message

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

About

Simple Node.js REST API to handle contact form submissions. Developed as part of a tutorial.

License:ISC License


Languages

Language:JavaScript 100.0%