/test-boilerplate

test

Primary LanguageJavaScriptISC LicenseISC

Express API Boilerplate

Logo

Overview

This is a boilerplate application for building REST APIs in Node.js using ES6 and Express. Helps you stay productive by following best practices.

Features

Directory Structure

•
├── config
│   └── auth.js
│   └── database.js
│   └── environment.js
│   └── mail.js
│   └── server.js
├── database
│   └── connection.js
├── middleware
│   └── error-handler
│   └── validation
├── modules
│   └── <module>
│       └── controller
│       │   └── index.js
│       │   └── create.js
│       │   └── read-all.js
│       │   └── read-one.js
│       │   └── update.js
│       │   └── destroy.js
│       └── middleware
│       └── policy
│       │   └── index.js
│       │   └── create.js
│       │   └── read-all.js
│       │   └── read-one.js
│       │   └── update.js
│       │   └── destroy.js
│       └── rules
│       │   └── create.js
│       │   └── update.js
│       │   └── destroy.js
│       └── service
│       │   └── <module>.service.js
│       └── test
│       └── model.js
│       └── schema.js
│       └── seed.js
│       └── router.js
├── utils
│   └── logger
│   └── mailer
│   └── response-format
├── app.js
├── router.js
└── server.js

Getting Started

...

Installation

...

Quick Start

...

Testing Email

When building complex applications then sooner or later you end up in a situation where you need to send emails from your application in test environment but do not want to accidentally spam anyone.

One solution would be to separate development email addresses and use only some specific testing address to send all mail to but a better approach would be to use a separate email catching service that accepts all messages like a normal transactional SMTP service would but instead of delivering these to destination, it only logs these messages.

There are several options for using such a service, Nodemailer has built-in support for Ethereal Email. You can create new testing account on the fly by using the createTestAccount method or from the Ethereal homepage.

Reference Links:

https://nodemailer.com/smtp/testing/

https://ethereal.email/