Add parkio

This commit is contained in:
2023-09-04 15:20:01 -06:00
commit 19eb9915fa
20 changed files with 5585 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
import { Controller, Get, Param } from '@nestjs/common';
import { ParkioService } from './parkio.service';
@Controller('parkio')
export class ParkioController {
constructor(
private readonly parkioService: ParkioService
) {}
@Get('auctions')
async getAuctions () {
return this.parkioService.fetchAuctions();
}
@Get('domains')
async getDomains () {
return this.parkioService.fetchAllDomains();
}
@Get('short/:maxLength')
async getShort (@Param('maxLength') maxLength: number) {
return {
maxLength,
domains: (await this.parkioService.fetchAllDomains()).filter(
parsedDomain => parsedDomain.domain_length <= maxLength
),
auctions: (await this.parkioService.fetchAuctions()).filter(
parsedAuction => parsedAuction.domain_length <= maxLength
),
}
}
}