@nestjs/common#Render TypeScript Examples
The following examples show how to use
@nestjs/common#Render.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: auth.controller.ts From nest-js-boilerplate with MIT License | 6 votes |
@ApiOkResponse({ description: 'Renders a login page' })
@ApiUnauthorizedResponse({ description: 'Returns an unauthorized ' })
@UseGuards(RedirectIfLoggedGuard)
@Get('/login')
@Render('login')
public index(@Req() req: ExpressRequest) {
return {
message: req.flash('loginError'),
};
}
Example #2
Source File: home.controller.ts From nest-js-boilerplate with MIT License | 6 votes |
@ApiCookieAuth()
@ApiOkResponse({
schema: {
type: 'object',
properties: {
data: {
$ref: getSchemaPath(User),
},
},
},
description: 'Returns the logged user',
})
@ApiUnauthorizedResponse({
schema: {
type: 'object',
example: {
message: 'string',
},
},
description: 'Returns the unauthorized error',
})
@UseGuards(IsLoggedGuard)
@Get('/')
@Render('home')
public getIndex(@RequestUser() user: User): User {
return user;
}
Example #3
Source File: users.controller.ts From nest-js-boilerplate with MIT License | 6 votes |
@ApiCookieAuth()
@ApiOkResponse({
schema: {
type: 'object',
properties: {
data: {
$ref: getSchemaPath(User),
},
},
},
description: 'Returns 200 if the template has been rendered successfully',
})
@ApiInternalServerErrorResponse({
schema: {
type: 'object',
example: {
message: 'string',
details: {},
},
},
description: 'Internal Server Error',
})
@UseGuards(IsLoggedGuard)
@Get('/profile')
@Render('profile')
public getProfile(@RequestUser() user: User): User {
return user;
}
Example #4
Source File: users.controller.ts From nest-js-boilerplate with MIT License | 6 votes |
@ApiCookieAuth()
@ApiOkResponse({
schema: {
type: 'object',
properties: {
data: {
$ref: getSchemaPath(User),
},
},
},
description: 'Returns 200 if the template has been rendered successfully',
})
@UseGuards(RolesGuard)
@Roles(RolesEnum.admin)
@Get()
@Render('all-users')
public async getAllUsers(@RequestUser() admin: User): Promise<any> {
const foundUsers = await this.usersService.getAll();
return { admin, users: foundUsers };
}
Example #5
Source File: home.controller.ts From nest-js-boilerplate with MIT License | 6 votes |
@ApiCookieAuth()
@ApiOkResponse({
schema: {
type: 'object',
properties: {
data: {
$ref: getSchemaPath(UserEntity),
},
},
},
description: 'Returns the logged user',
})
@ApiUnauthorizedResponse({
schema: {
type: 'object',
example: {
message: 'string',
},
},
description: 'Returns the unauthorized error',
})
@UseGuards(IsLoggedGuard)
@Get('/')
@Render('home')
public getIndex(@RequestUser() user: UserEntity): UserEntity {
return user;
}
Example #6
Source File: users.controller.ts From nest-js-boilerplate with MIT License | 6 votes |
@ApiCookieAuth()
@ApiOkResponse({
schema: {
type: 'object',
properties: {
data: {
$ref: getSchemaPath(UserEntity),
},
},
},
description: 'Returns 200 if the template has been rendered successfully',
})
@ApiInternalServerErrorResponse({
schema: {
type: 'object',
example: {
message: 'string',
details: {},
},
},
description: 'Internal Server Error',
})
@UseGuards(IsLoggedGuard)
@Get('/profile')
@Render('profile')
public getProfile(@RequestUser() user: UserEntity): UserEntity {
return user;
}
Example #7
Source File: users.controller.ts From nest-js-boilerplate with MIT License | 6 votes |
@ApiCookieAuth()
@ApiOkResponse({
schema: {
type: 'object',
properties: {
data: {
$ref: getSchemaPath(UserEntity),
},
},
},
description: 'Returns 200 if the template has been rendered successfully',
})
@UseGuards(RolesGuard)
@Roles(RolesEnum.admin)
@Get()
@Render('all-users')
public async getAllVerified(@RequestUser() admin: UserEntity): Promise<any> {
const foundUsers = await this.usersService.getAll();
return { admin, users: foundUsers };
}
Example #8
Source File: auth.controller.ts From nest-js-boilerplate with MIT License | 6 votes |
@ApiOkResponse({ description: 'Renders a login page' })
@ApiUnauthorizedResponse({ description: 'Returns an unauthorized ' })
@UseGuards(RedirectIfLoggedGuard)
@Get('/login')
@Render('login')
public index(@Req() req: ExpressRequest) {
return {
message: req.flash('loginError'),
};
}
Example #9
Source File: auth.controller.ts From nest-js-boilerplate with MIT License | 6 votes |
@ApiOkResponse({ description: 'Renders a login page' })
@ApiUnauthorizedResponse({ description: 'Returns an unauthorized ' })
@UseGuards(RedirectIfLoggedGuard)
@Get('/login')
@Render('login')
public index(@Req() req: ExpressRequest) {
return {
message: req.flash('loginError'),
};
}
Example #10
Source File: auth.controller.ts From nest-js-boilerplate with MIT License | 5 votes |
@ApiOkResponse({ description: 'Redners a sign up page' })
@ApiUnauthorizedResponse({ description: 'Returns the unauthorized error' })
@UseGuards(IsNotLoggedGuard)
@Get('/sign-up')
@Render('signup')
public async signUp(): Promise<void> {}
Example #11
Source File: auth.controller.ts From nest-js-boilerplate with MIT License | 5 votes |
@ApiOkResponse({ description: 'Renders a sign up page' })
@ApiUnauthorizedResponse({ description: 'Returns the unauthorized error' })
@UseGuards(IsNotLoggedGuard)
@Get('/sign-up')
@Render('signup')
public async signUp(): Promise<void> { }
Example #12
Source File: auth.controller.ts From nest-js-boilerplate with MIT License | 5 votes |
@ApiOkResponse({ description: 'Redners a sign up page' })
@ApiUnauthorizedResponse({ description: 'Returns the unauthorized error' })
@UseGuards(IsNotLoggedGuard)
@Get('/sign-up')
@Render('signup')
public async signUp(): Promise<void> {}
Example #13
Source File: system.controller.ts From emutypekov with GNU General Public License v3.0 | 5 votes |
@Get('/')
@Render('home')
index(): any {
return { h: 'Welcome to EmiTarkov.' };
}
Example #14
Source File: app.controller.ts From MyAPI with MIT License | 5 votes |
@Get()
@Render('home')
@ApiExcludeEndpoint()
getHome(): { message: string } {
return {
message: this.appService.getHello()
}
}