Commit 0666aa02 authored by nanahira's avatar nanahira

cache result

parent 7b26e1fb
Pipeline #20031 passed with stages
in 38 seconds
import { Controller, Get, Req } from '@nestjs/common'; import { Controller, Get, Req, Res } from '@nestjs/common';
import { AppService } from './app.service'; import { AppService } from './app.service';
import { Request } from 'express'; import { Request, Response } from 'express';
@Controller() @Controller()
export class AppController { export class AppController {
constructor(private readonly appService: AppService) {} constructor(private readonly appService: AppService) {}
@Get('*') @Get('*')
render(@Req() req: Request) { async render(@Req() req: Request, @Res({ passthrough: true }) res: Response) {
return this.appService.render(req); const result = await this.appService.render(req);
res.header('Cache-Control', 'public, max-age=3600, immutable');
return result;
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment