Skip to content

Instantly share code, notes, and snippets.

@lexyblazy
Last active October 24, 2019 23:56
Show Gist options
  • Save lexyblazy/c8cc7d5eb128650c164cec042150d2b1 to your computer and use it in GitHub Desktop.
Save lexyblazy/c8cc7d5eb128650c164cec042150d2b1 to your computer and use it in GitHub Desktop.
Firebase admin initialized
import * as firebaseAdmin from "firebase-admin";
import * as functions from "firebase-functions";
import express from "express";
import * as serviceAccount from "./serviceAccount.json";
const app = express();
const firebase = firebaseAdmin.initializeApp({
credential: firebaseAdmin.credential.cert({
projectId: serviceAccount.project_id,
clientEmail: serviceAccount.client_email,
privateKey: serviceAccount.private_key
}),
databaseURL: <YOUR_DATABASE_URL>
});
app.get("/", (req: express.Request, res: express.Response) => {
res.send("Now we are live with the express server");
});
export const v1 = functions.https.onRequest(app);
{
"compilerOptions": {
"module": "commonjs",
"noImplicitReturns": true,
"noUnusedLocals": true,
"outDir": "lib",
"sourceMap": true,
"strict": true,
"target": "es2017",
"resolveJsonModule": true // add this line to resolve json modules
"esModuleInterop" : true // add this for common js module resolution
},
"compileOnSave": true,
"include": ["src"]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment