import { Controller, Get, Param } from '@nestjs/common'; import { NamesService } from './names.service'; @Controller('names') export class NamesController { constructor(private readonly namesService: NamesService) {} @Get() async getNameList() { return await this.namesService.getNameList(); } @Get(':name') async getNameInformation(@Param('name') name: string) { return { popularity: await this.namesService.getSsaNameData(name), otherSites: { behindTheName: `https://www.behindthename.com/name/${name.toLocaleLowerCase()}`, babynames: `https://www.babynames.com/name/${name.toLocaleLowerCase()}`, }, behindTheName: { synonyms: await this.namesService.getBtnSynonyms(name), }, }; } }