Skip to content
Snippets Groups Projects
images.controller.ts 474 B
Newer Older
  • Learn to ignore specific revisions
  • import {
        Controller,
        Get,
        Header,
        HttpCode,
        Param,
        Res,
        UseGuards,
    } from '@nestjs/common';
    
    import { Response } from 'express';
    import { join } from 'path';
    import { WebAuthGuard } from './auth/web-auth.guard';
    
    @Controller('images')
    @UseGuards(WebAuthGuard)
    export class ImageController {
        @Get(':id')
    
        public image(@Param('id') id: string, @Res() res: Response) {
    
            res.sendFile(join(process.cwd(), 'photos', `${id}.jpg`));
        }