Skip to content

pandaling/service-email

Repository files navigation

Project

A microservice for sending email.

Tech used

  • nodejs - typescript
  • nodemailer npm package
  • mailtrap

How to start

  1. update the config file .env.example to use actual value.
  2. rename /env.example to .env.
  3. Install all the dependencies.
$ npm install
  1. To start the program.
$ npm start
  1. Upon successfully start the program, you should see below messages in the terminal architecture diagran

  2. If good, then use the snippet below for testing. It should return response message Success.

curl --location --request POST 'localhost:6011/v1/test/my/register/verify' \
--header 'Content-Type: application/json' \
--header 'Cookie: _auth_verification=%7B%22nonce%22%3A%22mdtZwdfYO9DCCPngN5xdPjTSXGZB3Ux4Z3Wi-9YBa6E%22%2C%22state%22%3A%22eyJyZXR1cm5UbyI6Ii9wcm9maWxlIn0%22%7D.a8UpEEWhgu3uAogRf_H4V3l54fotQ0KeIcDAmxFjxlo; skipSilentLogin=true' \
--data-raw '{
    "to": "panda@email.com",
    "subject": "This is email content",
    "userRole": "ADMIN",
    "type": "VERIFY_OTP"
}'
  1. Check in mailtrap architecture diagran

How to run the test

  1. To run the test, use command npm run test.

Architecture

Architecture diagram

architecture diagran

Time contraint

Due to time constraint, there are few more features not implemented properly, such as email template, role based authorization as well as the structure.

About

A node service for mailing

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published