-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ts
23 lines (22 loc) · 812 Bytes
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import { NestFactory } from '@nestjs/core';
import { ExpressAdapter } from '@nestjs/platform-express';
import * as express from 'express';
import * as functions from 'firebase-functions';
import * as admin from 'firebase-admin';
import { AppModule } from './src/app.module';
admin.initializeApp({
credential: admin.credential.cert(functions.config().washly_config),
databaseURL: 'https://laundry-guru-50b7a.firebaseio.com',
});
const expressServer = express();
const createFunction = async (expressInstance): Promise<void> => {
const app = await NestFactory.create(
AppModule,
new ExpressAdapter(expressInstance),
);
await app.init();
};
export const api = functions.https.onRequest(async (request, response) => {
await createFunction(expressServer);
expressServer(request, response);
});