0.6.19 • Published 1 year ago

@dotslibrary/dots-core v0.6.19

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

Dots-Core

Fast, scalable which supports http & event driven communication build on top of express node.

Installation

This is a Node.js module available through the private npm registry.

Before installing, download and install Node.js. Node.js 12 or higher is required.

Installation is done using the npm install command:

$ npm install @dotslibrary/dots-core

Inside the modules create a file called index.js:

import { app, applicationBootstrap } from 'woz-lib'

import { user } from './user/user.controller'

app.use(user.router)

applicationBootstrap(app, {
    MONGO_DB_URL: process.env.MONGO_DB,
    RABBIT_MQ_URL: process.env.RABBIT_MQ,
}).then(() => {
    const queue = MESSAGE_QUEUE.SMS_OTP

    subscribe(queue, msg => {
        console.log(queue, msg)
    })
    publish(queue, msg => {
        console.log(queue, msg)
    })
})

subscribe & publish methods are bulid on top of RabbitMq, it handles all the complexity of queues.

subscribe method listens on a given queue and executes registered callback function.

publish method emits message on a given queue.

Environments directory contains different env profiles

Start application using one of the below command Consumes env variables from environments/dev.env

npm run start:dev

Consumes env variables from environments/prod.env

npm run start:prod

Consumes env variables from environments/test.env

npm run start:test

Below are mandatory env variables

NODE_ENV = test
PORT = 7000
MONGO_DB = 'mongodb://localhost/my_database'
RABBIT_MQ = 'amqp://userData:passwordData1@localhost'

Features

  • Robust routing
  • Focus on high performance
  • Super-high test coverage
  • HTTP helpers (redirection, caching, etc)
  • message queue handler
  • View system supporting 14+ template engines
  • Exception handler
  • Executable for generating applications quickly

Project setup

$ git checkout intro/mock-application && npm install

Business logic blocks should be under modules directory, follow the structure of users under modules.

  • Controller contains application routes, request validation and should contain only single method from the service.
  • Model has business logic data points.
  • Repository consists methods which are used to retrieve data from db.
  • Util add helper function to service layer.
  • Service layer combines response of from repository & util.
  • DTO consists data points from the request.
  • Interface consists types I/O of methods.
├── tsconfig.json
├── npmrc
├── prettierignore
├── prettierrc
├── eslintrc
├── eslintignore
├── gitignore
├── package.json
├── environments
│         ├── dev.env
│         ├── prod.env
│         └── test.env
│
└── modules
      ├── index.ts
      └── users
           ├── user.controller.ts
           ├── user.model.ts
           ├── user.util.ts
           ├── user.repository.ts
           ├── user.dto.ts
           ├── user.interface.ts
           └── user.service.ts

Entry file index.ts wraps all the routers and bootstraps application in @dotslibrary/dots-core.

Follow the mock application from intro/mock-application as sample project using @dotslibrary/dots-core

0.6.18

1 year ago

0.6.19

1 year ago

0.6.17

2 years ago

0.6.14

2 years ago

0.6.16

2 years ago

0.6.15

2 years ago

0.6.15-t4

2 years ago

0.6.15-t1

2 years ago

0.6.15-t2

2 years ago

0.6.15-t

2 years ago

0.6.9

2 years ago

0.6.8

2 years ago

0.6.10

2 years ago

0.6.12

2 years ago

0.6.11

2 years ago

0.6.13

2 years ago

0.6.7

2 years ago

0.6.6

2 years ago

0.6.5

2 years ago

0.6.4

2 years ago

0.6.3

2 years ago

0.6.2

3 years ago

0.6.1

3 years ago

0.6.0

3 years ago

0.5.0

3 years ago

0.4.0

4 years ago

0.3.9

4 years ago

0.3.8

4 years ago

0.3.7

4 years ago

0.3.6

4 years ago

0.3.5

4 years ago

0.3.4

4 years ago

0.3.3

4 years ago

0.3.2

4 years ago

0.3.1

4 years ago

0.3.0

4 years ago

0.2.9

4 years ago

0.2.8

4 years ago

0.2.7

4 years ago

0.2.6

4 years ago

0.2.5

4 years ago

0.2.4

4 years ago

0.2.3

4 years ago

0.2.2

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.1.9

4 years ago

0.1.8

4 years ago

0.1.7

4 years ago

0.1.6

4 years ago

0.1.5

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago