Git Product home page Git Product logo

node-simple-email-api's Introduction

node-simple-email-api

This simple email api service is build by using Serverless framework and will be deployed to AWS lambda service.

Pre-Prerequisite

  • Install NodeJs version v14.x

How to launch the API application

Clone the repository:

git clone https://github.com/kenttan0214/node-simple-email-api

Install dependencies:

cd node-simple-email-api
npm install

Putting together necessary configurations:

Refer to .env-cmdrc.example, update the fields accordingly

Setup local env config:

cp .env-cmdrc.example .env-cmdrc

Start local instance:

npm start

To run the email API

curl --location --request POST 'http://localhost:3000/test/email' \
--header 'Content-Type: application/json' \
--data-raw '{
    "subject": "test email subject",
    "content": "simple email content",
    "recipients": ["[email protected]"]
}'

Run Unit Test

npm test

ESLint and format

npm run lint
npm run format

Folder Structure

.
├── src              
│   ├── __mock__            # Unit test mock fuctions & data
│   ├── handler             # API Schema and Response layer
│   ├── helper              # The actual execution and a layer to connect with API, data, model and util ...
│   └── type                # Typescript type definitions
│   └── util                # Generic util functions
│   └── middleware          # Middy middleware
└── ...

Known limitation of this demo

  1. Use nodemailer test account as demo of the send email capability instead of using any of the email provider SMTP server such as Gmail.
  2. The email content is plant text just enough for demo the use case, actual case might need html formatting template
  3. Actual use case should consider use AWS SES this kind of service to ease the maintainability
  4. Unit test coverage is only collect from helper and handler for show case purpose
  5. No deployment setup as this will need to create an AWS account

node-simple-email-api's People

Contributors

kenttan0214 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.