Skip to content
This repository has been archived by the owner on Oct 17, 2024. It is now read-only.

Curious about how this compares to my current implementation #233

Open
dilizarov opened this issue Sep 8, 2020 · 0 comments
Open

Curious about how this compares to my current implementation #233

dilizarov opened this issue Sep 8, 2020 · 0 comments

Comments

@dilizarov
Copy link

I've incorporated Firebase Auth into my NestJS product. It requires firebase-admin and I include like such:

main.ts

import { NestFactory } from "@nestjs/core";
import { AppModule } from "app.module";
import * as admin from "firebase-admin";

/**
 * If there comes a time that we want to exclude "api" prefix
 * from certain controllers, then refernce this answer:
 *
 * https://github.com/nestjs/nest/issues/255#issuecomment-360749246
 *
 * Otherwise, this functionality doesn't exist atm.
 * I think it is actively being discussed/worked on though
 */
async function bootstrap() {
  const app = await NestFactory.create(AppModule);
  app.setGlobalPrefix("api");

  // Redacted the URL and credential for our purposes here
  admin.initializeApp({
    credential: <CREDENTIAL_CERT>,
    databaseURL: <DATEBASE_URL>
  });

  await app.listen(5000);
}
bootstrap();

Everything works fine, but then I came across this npm library.

Is there a benefit to using your method over what I did above? Is your method explicitly for baking firebase-admin into the dependency injection flow?

@dilizarov dilizarov changed the title Are there any perks to this over just Curious about how this compares to my current implementation Sep 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant