I'm using NestJS as my backend Framework and Firebase.
To integrate Nest with Firebase on HTTP requests is simple as attaching the express instance of nest to Firebase:
const server: Express = express();
const bootstrap = async (expressInstance: Express) => {
const app = await NestFactory.create(AppModule, expressInstance);
await app.listen(3000);
await app.init();
};
bootstrap(server);
exports.api = functions.https.onRequest(server);
But what about the other Google Functions (such as pubsub, firestore, auth, etc.)?
I'm building a subscription application, and I depend on functions.pubsub to check at the end of every day which subscriptions should I charge. It requires writing business logic that I want to write withing NestJs.
I'm trying to achieve something like this (in a nutshell):
functions.pubsub
.topic('topic')
.onPublish(app.getService(Service).method);