diff --git a/src/app.module.ts b/src/app.module.ts index ca348d4..60bc28f 100644 --- a/src/app.module.ts +++ b/src/app.module.ts @@ -1,8 +1,9 @@ import { Module } from '@nestjs/common'; import { ApiModule } from './api/api.module'; import { CrawlerModule } from './crawler/crawler.module'; +import { DbModule } from './db/db.module'; @Module({ - imports: [ApiModule, CrawlerModule] + imports: [ApiModule, CrawlerModule, DbModule] }) export class AppModule {} diff --git a/src/crawler/crawler.service.ts b/src/crawler/crawler.service.ts index 0877df2..074a97d 100644 --- a/src/crawler/crawler.service.ts +++ b/src/crawler/crawler.service.ts @@ -42,6 +42,18 @@ export class CrawlerService { // URLS // const urls = await page.$$eval('a', links => links.map(link => link.href)); await browser.close(); + + // // save to db + // this.dbService.insert({ + // url, + // domain, + // cssSheetsLocation, + // scriptsSheetsLocation, + // screenshotBuffer, + // urls + // }, 'crawler'); + + } async downloadFiles(urls: string[], path: string) { diff --git a/src/db/db.service.ts b/src/db/db.service.ts index 9e9ffdd..dc92d3f 100644 --- a/src/db/db.service.ts +++ b/src/db/db.service.ts @@ -5,4 +5,8 @@ export class DbService { constructor() { console.log(`DbService constructor`); } + + insert(data, collection) { + console.log(`DbService insert`); + } }