@nexst/core
v0.0.62
Published
⚡ next + nest ⚡
Downloads
92
Maintainers
Readme
NexstAppModule & NextModule
In the server/app.module.ts
:
import {
Module,
MiddlewareConsumer,
} from '@nestjs/common';
import {
NexstAppModule,
NextModule,
} from '@nexst/core';
import { AppController } from './app.controller';
@Module({
imports: [
NextModule,
],
controllers: [
AppController,
],
})
export class AppModule extends NexstAppModule {
configure(consumer: MiddlewareConsumer) {
super.configure(consumer);
// additional configurations here
}
}
Then, use render()
function where you want to SSR:
import {
Controller,
Get,
Req,
Res,
} from '@nestjs/common';
import {
Request,
Response,
} from 'express';
import { NextService } from '@nexst/core';
@Controller('auth')
export class AuthController {
constructor(private readonly nextService: NextService) {}
@Get('register')
public async showRegisterPage(@Req() req: Request, @Res() res: Response) {
return await this.nextService.render(req, res, 'auth/register');
}
}
This will render pages/auth/register.tsx
!