feat: add hello world endpoint in firebase cloud functions

This commit is contained in:
Harsh Gupta (aider) 2024-08-14 16:42:03 +05:30
parent f927aab144
commit b682ee5bb5

View File

@ -1,7 +1,7 @@
import 'reflect-metadata'; import 'reflect-metadata';
import { initializeApp } from 'firebase-admin/app'; import { initializeApp } from 'firebase-admin/app';
import { CrawlerHost } from './cloud-functions/crawler'; import { CrawlerHost } from './cloud-functions/crawler';
import { https } from 'firebase-functions'; import { https, HttpsFunction } from 'firebase-functions';
import { Logger } from './shared/logger'; import { Logger } from './shared/logger';
import { container } from 'tsyringe'; import { container } from 'tsyringe';
import { PuppeteerControl } from './services/puppeteer'; import { PuppeteerControl } from './services/puppeteer';
@ -22,6 +22,10 @@ const crawlerHost = container.resolve(CrawlerHost);
export const crawler = https.onRequest(async (req, res) => { export const crawler = https.onRequest(async (req, res) => {
await crawlerHost.crawl(req, res); await crawlerHost.crawl(req, res);
}); });
export const helloWorld: HttpsFunction = https.onRequest((req, res) => {
res.send('Hello World!');
});
// import { loadModulesDynamically, registry } from './shared'; // import { loadModulesDynamically, registry } from './shared';
// import path from 'path'; // import path from 'path';
// loadModulesDynamically(path.resolve(__dirname, 'cloud-functions')); // loadModulesDynamically(path.resolve(__dirname, 'cloud-functions'));