1.0.37 • Published 4 years ago

ibcurt-module-common v1.0.37

Weekly downloads
49
License
MIT
Repository
-
Last release
4 years ago

Seed module

This is common module for Hapi Nodejs.

Setup

This seed is loaded with the following tools/libraries:

  • Husky
  • Jest
  • Prettier
  • Eslint
  • Typescript

Running module in local for test usage

https://docs.npmjs.com/cli/link

Modules

Logger

  • create a Nodejs logger with json format:
import { createLogger } from 'ibcurt-module-common'

const logger = createLogger({
  level: 'debug', // the minimal level that you want to show the log
  serviceName: 'ibcurt-module-common' // the name of service that you want to log
  pretty: false // Default: false, set true when you want to provide the basic prettifier for log lines
  mixin: () => {[key: string]: any} // mixin function when you want to add more thing when call logger function
});

Context

  • this is a wrapper of cls-hooked for creating a Nodejs context
// context.ts
import { Context } from 'ibcurt-module-common'
export default new Context('this is context' /* the context name, you can create the context without put name */);

// setup.ts
import context from './context'
...
context.set('key', 'value');

// use.ts
import context from './context'
...
const value = context.get('key');
1.0.33

4 years ago

1.0.37

4 years ago

1.0.36

4 years ago

1.0.35

4 years ago

1.0.34

4 years ago

1.0.32

4 years ago

1.0.31

4 years ago

1.0.30

4 years ago

1.0.29

4 years ago

1.0.28

4 years ago

1.0.26

4 years ago

1.0.27

4 years ago

1.0.25

5 years ago

1.0.24

5 years ago

1.0.22

5 years ago

1.0.21

5 years ago

1.0.23

5 years ago

1.0.20

5 years ago

1.0.19

5 years ago

1.0.18

5 years ago

1.0.17

5 years ago

1.0.16

5 years ago

1.0.15

5 years ago

1.0.14

5 years ago

1.0.13

5 years ago

1.0.11

5 years ago

1.0.12

5 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago