Skip to content

Commit 5adc755

Browse files
committed
feat(nestjs-redox): add option for favicon
1 parent 78cd994 commit 5adc755

File tree

5 files changed

+1455
-546
lines changed

5 files changed

+1455
-546
lines changed

apps/demo-express/src/app/app.module.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
import { Module } from '@nestjs/common';
22

3+
import { ServeStaticModule } from '@nestjs/serve-static';
4+
import { join } from 'path';
35
import { AppController } from './app.controller';
46
import { AppService } from './app.service';
57

68
@Module({
7-
imports: [],
9+
imports: [
10+
ServeStaticModule.forRoot({
11+
rootPath: join(__dirname, 'assets'),
12+
serveRoot: '/api/assets',
13+
}),
14+
],
815
controllers: [AppController],
916
providers: [AppService],
1017
})

libs/nestjs-redox/src/lib/types.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,13 @@ export class NestJSRedoxOptions {
207207
*/
208208
overwriteHeadersWith?: Record<string, string>;
209209

210+
/**
211+
* Sets a favicon
212+
*/
213+
favicon?: {
214+
url?: string;
215+
};
216+
210217
constructor(partial?: Partial<NestJSRedoxOptions>) {
211218
if (partial) {
212219
Object.assign(this, partial);

libs/nestjs-redox/src/lib/views/index.hbs.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ export const REDOC_HANDLEBAR = `
66
<head>
77
<title>{{ document.info.title }}</title>
88
<meta charset="utf-8" />
9-
{{#if data.redoxOptions.favicon}}
10-
<link rel="shortcut icon" type="image/x-icon" href="{{ redoxOptions.favicon }}" />
9+
{{#if redoxOptions.favicon.url }}
10+
<link rel="shortcut icon" type="image/x-icon" href="{{{ redoxOptions.favicon.url }}}" />
1111
{{/if}}
1212
{{#unless redoxOptions.disableGoogleFont}}
1313
<link href="https://fonts.googleapis.com/css?family=Montserrat:300,400,700|Roboto:300,400,700" rel="stylesheet">

0 commit comments

Comments
 (0)