File

src/url/url-shortener.controller.ts

Prefix

url/shorten

Index

Methods

Methods

Async shortenUrl
shortenUrl(options: UrlShortenerDto)
Decorators :
@Get()
@ApiOkResponse({type: ShortURL})
Parameters :
Name Type Optional
options UrlShortenerDto No
Returns : unknown
import { Controller, Get, Query } from "@nestjs/common";
import { ApiOkResponse, ApiTags } from "@nestjs/swagger";

import { UrlShortenerService } from "./url-shortener.service";
import { UrlShortenerDto } from "./dtos/url.dto";
import { ShortURL } from "./dtos/short-url.dto";

@Controller("url/shorten")
@ApiTags("Url Shortener Service")
export class UrlShortenerController {
  constructor(private urlShortener: UrlShortenerService) {}

  @Get()
  @ApiOkResponse({ type: ShortURL })
  async shortenUrl(@Query() options: UrlShortenerDto) {
    return this.urlShortener.shortenUrl(options.url);
  }
}

results matching ""

    No results matching ""