removed unused code

This commit is contained in:
Kfir Dayan 2024-01-21 11:33:25 +02:00
parent be5117feca
commit 5e5a584042
2 changed files with 0 additions and 3 deletions

View file

@ -7,11 +7,9 @@ export class DnsService {
private lookup = util.promisify(dns.lookup); private lookup = util.promisify(dns.lookup);
async isValidUrl(url: string): Promise<boolean> { async isValidUrl(url: string): Promise<boolean> {
console.log('HERE!!!')
try { try {
const hostname = new URL(url).hostname; const hostname = new URL(url).hostname;
await this.lookup(hostname); await this.lookup(hostname);
console.log('HERE!')
return true; return true;
} catch { } catch {
return false; return false;

View file

@ -7,7 +7,6 @@ export class UrlShortenerController {
@Post('shorten') @Post('shorten')
async shortenUrl(@Body('url') url: string): Promise<{ shortUrl: string }> { async shortenUrl(@Body('url') url: string): Promise<{ shortUrl: string }> {
// example route http://localhost:3000/url-shortener/shorten POST body { url: 'https://www.google.com' }
if (!url) { if (!url) {
throw new HttpException('URL is required', HttpStatus.BAD_REQUEST); throw new HttpException('URL is required', HttpStatus.BAD_REQUEST);
} }