This package has been deprecated

Author message:

Deprecated and unmaintained. Check out nestjs-pino as alternative.

nest-morgan
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

Nest Logo

Morgan Module for Nest framework

NPM Version Package License NPM Downloads Github Actions - Test

Not activly maintained!

This module is not activly maintainer. Any PR's will be reviewd/merged/released. But i don't plan to work on, or add any new functionality to this module.

Description

This's a Morgan module for Nest.

Installation

$ npm i --save nest-morgan morgan @types/morgan

Versions

  • 2.x Is for Nest v7.x
    • Remove the need to use MorganModule.forRoot() #17.
  • 1.x Is for Nest v6.x
  • 0.x Is for Nest v5.x

Quick Start

Include Module

app.module.ts

@Module({
  imports: [MorganModule],
})
export class ApplicationModule {}

Global

If you want to set up interceptor as global, you have to follow Nest instructions here. Something like this:

app.module.ts

import { Module } from "@nestjs/common";
import { APP_INTERCEPTOR } from "@nestjs/core";
import { MorganModule, MorganInterceptor } from "nest-morgan";

@Module({
  imports: [MorganModule],
  providers: [
    {
      provide: APP_INTERCEPTOR,
      useClass: MorganInterceptor("combined"),
    },
  ],
})
export class ApplicationModule {}

Using Interceptor

app.controller.ts

  @UseInterceptors(MorganInterceptor('combined'))
  @Get('/some/route')
  public async someRoute() {
    ...
  }

Package Sidebar

Install

npm i nest-morgan

Weekly Downloads

5,068

Version

2.0.0

License

MIT

Unpacked Size

11.3 kB

Total Files

15

Last publish

Collaborators

  • mentos1386