This repository has been archived by the owner on Jul 8, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a25afb8
commit a38e782
Showing
9 changed files
with
268 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,9 @@ | ||
import { DynamicModule, Global, Module } from "@nestjs/common"; | ||
import { Global, Module } from "@nestjs/common"; | ||
import { morganProviders } from "./morgan.providers"; | ||
|
||
@Global() | ||
@Module({ | ||
providers: [...morganProviders], | ||
exports: [...morganProviders], | ||
}) | ||
export class MorganModule { | ||
static forRoot(): DynamicModule { | ||
return { | ||
module: MorganModule, | ||
}; | ||
} | ||
} | ||
export class MorganModule {} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,29 @@ | ||
import { Controller, Get, UseInterceptors } from '@nestjs/common'; | ||
import { MorganInterceptor } from '../lib'; | ||
import { Controller, Get, UseInterceptors } from "@nestjs/common"; | ||
import { MorganInterceptor } from "../lib"; | ||
|
||
@Controller('') | ||
@Controller("") | ||
export class HelloController { | ||
|
||
@Get('common/works') | ||
@UseInterceptors(MorganInterceptor('common')) | ||
@Get("common/works") | ||
@UseInterceptors(MorganInterceptor("common")) | ||
works_common() { | ||
return 'Works'; | ||
return "Works"; | ||
} | ||
|
||
@Get('common/error') | ||
@UseInterceptors(MorganInterceptor('common')) | ||
@Get("common/error") | ||
@UseInterceptors(MorganInterceptor("common")) | ||
error_common() { | ||
throw new Error('Something bad happened'); | ||
throw new Error("Something bad happened"); | ||
} | ||
|
||
@Get('combined/works') | ||
@UseInterceptors(MorganInterceptor('combined')) | ||
@Get("combined/works") | ||
@UseInterceptors(MorganInterceptor("combined")) | ||
works_combined() { | ||
return 'Works'; | ||
return "Works"; | ||
} | ||
|
||
@Get('combined/error') | ||
@UseInterceptors(MorganInterceptor('combined')) | ||
@Get("combined/error") | ||
@UseInterceptors(MorganInterceptor("combined")) | ||
error_combined() { | ||
throw new Error('Something bad happened'); | ||
throw new Error("Something bad happened"); | ||
} | ||
} |
Oops, something went wrong.