Coder Social home page Coder Social logo

pickles_test's Introduction

Overview

Test Email Notification service.

Technology Stack

  • Node.js v14 server.
  • NPM v7 Node Package Manager.
  • TypeScript v3.7.2 is a language for application-scale JavaScript.
  • Express v4.16.3 node.js framework for building REST APIs
  • Jest v26.6.3 Jest is used to test JavaScript frameworks
  • Supertest v6.1.3 provide a high-level abstraction for testing HTTP

Prerequisite

Key Features

  1. src/config: This folder has mainly one file:

    • config.core.ts which contains all the configurable variables required in the service. Use this file to add any new variable. This file basically picks up variables from environment (process.env), will use default if not found. In order to set these variables, create a .env file (similar to .env-example file)
  2. src/controllers: it contains all the features required in this service with each feature in separate folder, currently, there is multiple feature named accordingly. There are some commonly used files in each controller method with different feature:

    • controller.ts contains all the methods related with that feature, called on an API endpoint request
    • router.ts contains all the routes related with this feature
    • validation.ts contains validation for request parameters or data
  3. src/lib: This folder has common library which we can use in our services, in future we can create a separate package for this. Currently, it has few files:

    • Logger.ts Logger Lib and various related methods
    • Swagger.ts Swagger class and related methods
    • constants.ts constants file contain all the constants
    • validations.ts This file contains all common validation for request parameters or data
  4. src/entities: This folder has common library which we can use in our services, in future we can create a separate package for this. Currently, it has mainly two folders:

    • errors it has classes to handle API errors
    • responses Different types of API response with appropriate code
  5. src/repositories The repository is a gateway between your domain/business layer and a data mapping layer, which is the layer that accesses the database and does the operations. Basically, the repository is an abstraction to your database access. TODO: This is currently empty, but we need to update our flow to use repositories

  6. src/services The service provide an API to your business logic, therefore being an abstraction to your repository, because the business layer is an abstraction of your data access layer, It has following services:

    • MailTransporter.ts
    • Database.ts DB Connection

Getting Started - Setup

This section is for getting started with Kue server on your development environment.

  1. Clone the repository
git clone https://github.com/ankitmalikfun/pickles_test.git
  1. Configure app

Clone .env.example and rename it to .env then edit it with your settings. You will need:

SMTP environment variables
  • EMAIL_HOST
  • EMAIL_PORT
  • EMAIL_AUTH_USER
  • EMAIL_AUTH_PASS

How to start/run service

This section is for starting/running the service.

  1. Install all the package.json file's dependencies by running the below command
npm install
  1. To start the application, run the below command
npm run start
  1. To run the service, open the below url in web browser
http://localhost:3000/api-docs/

IDE

  • Preferred IDE is VSCODE

Please enable following plugins for your editor:

  • EditorConfig: To enable reading of .editorconfig file for consistent coding convention.
  • SonarLint: To enable error catch by sonarjs.
  • TSlint: For linting errors

Troubleshooting section

  • TODO

Note:

Used mailtrap.oi for test mail account

  • It's a email sandbox service. Please use test sanbox account credentials for testing the service

pickles_test's People

Contributors

ankitmalikfun avatar

Watchers

 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.