- install the app
npm install
- start the development server
npm run dev
- run all tests
npm run test
Default email is not [email protected] because mailgun account is testing one, so there is no auth from [email protected]
Two auth gmail account are [email protected] and [email protected], only these two email address is working properly.
- add sending email function
- add persisting message endpoint
- add getting message endpoint
- add validator for email address: valid email example => [email protected], [email protected] invalid email example => example@domain, example
- add request body and query validation
- add testing with mocha
- send emails url: ${domain}/api/v1/emails/email methid: POST request body(JSON format) { "name": "xxx", "email":"xxx", "subject":"testing", "details":"bbb" } All properties in request body are necessary
- keep message information in database url: ${domain}/api/v1/messages/message methid: POST request body(JSON format) { "name": "xxx", "email":"xxx", "mobile":"xxxx", "subject":"testing", "details":"The testing email content." } All properties in request body are necessary
- get message information based on message uuid url: ${domain}/api/v1/messages/message?messageId=xxx-xxx-xxx methid: GET messageId in request query is necessary
How to start API (.env should not be in github, but for your convenience, I still add in this repository)
- You must installed Node version 8.9.x and make sure no any process is running on port 5000
- Run "npm install" to install all dependencies
- Run "npm run dev" to start, the api will running on port 5000
- "ctrl+c" could stop the app
- Run "npm run test" to run all unit test