diff --git a/package.json b/package.json index 0d64b62..0b21ce2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "url-manager-app", - "version": "1.0.0", + "version": "1.0.1", "description": "Url manager system with Rest API for management of short urls, click statistics and redirects by personalized codes", "author": "Andrea Tombolato (https://github.com/andreacw5)", "private": true, diff --git a/src/modules/app/app.controller.ts b/src/modules/app/app.controller.ts index 52d0c05..2c2c225 100644 --- a/src/modules/app/app.controller.ts +++ b/src/modules/app/app.controller.ts @@ -1,6 +1,7 @@ import { Controller, Get, Logger, Param, Res } from '@nestjs/common'; import { UrlsService } from '../url/urls.service'; import { ConfigService } from '@nestjs/config'; +import { ApiOperation, ApiParam, ApiResponse } from "@nestjs/swagger"; @Controller() export class AppController { @@ -25,6 +26,9 @@ export class AppController { await res.redirect(this.DEFAULT_REDIRECT_URL); } + @ApiOperation({ summary: 'Redirect by code' }) + @ApiParam({ name: 'code', description: 'The code to redirect' }) + @ApiResponse({ status: 200, description: 'Redirect returned' }) @Get('/:code') async redirectToCode(@Param('code') code, @Res() res) { this.logger.log(`Redirect to ${code} requested`); diff --git a/src/modules/url/urls.controller.ts b/src/modules/url/urls.controller.ts index 661c87b..653a836 100644 --- a/src/modules/url/urls.controller.ts +++ b/src/modules/url/urls.controller.ts @@ -26,7 +26,7 @@ import { UpdateUrlDTO } from './dto/edit-url-dto'; import { AuthGuard } from '@nestjs/passport'; @ApiTags('urls') -@Controller('urls') +@Controller('/api/urls') export class UrlsController { constructor(private readonly urlsService: UrlsService) {} private readonly logger = new Logger(UrlsController.name);