Skip to content

Instantly share code, notes, and snippets.

View lexyblazy's full-sized avatar

Olalekan Adekola lexyblazy

  • Africa | Europe
View GitHub Profile
@lexyblazy
lexyblazy / index.ts
Last active October 31, 2019 00:47
API routes
import * as firebaseAdmin from "firebase-admin";
import * as functions from "firebase-functions";
import express from "express";
import nanoid from "nanoid"; // we use this npm package to generate unique ids for our documents.
import * as serviceAccount from "./serviceAccount.json";
const app = express();
const firebase = firebaseAdmin.initializeApp({
credential: firebaseAdmin.credential.cert({
@lexyblazy
lexyblazy / index.ts
Created October 23, 2019 14:46
Writing to the database
import * as firebaseAdmin from "firebase-admin";
import * as functions from "firebase-functions";
import * as express from "express";
import * as serviceAccount from "./serviceAccount.json";
const app = express();
const firebase = firebaseAdmin.initializeApp({
@lexyblazy
lexyblazy / index.ts
Last active October 24, 2019 23:56
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({
@lexyblazy
lexyblazy / package.json
Created October 22, 2019 12:47
script section package.json
{
"name": "functions",
"scripts": {
"lint": "tslint --project tsconfig.json",
"build": "tsc",
"serve": "npm run build && firebase serve --only functions",
"shell": "npm run build && firebase functions:shell",
"start": "npm run shell",
"deploy": "firebase deploy --only functions",
@lexyblazy
lexyblazy / index.ts
Last active October 22, 2019 13:23
Express server is live
import * as functions from "firebase-functions";
import * as express from "express";
const app = express();
app.get("/", (req: express.Request, res: express.Response) => {
res.send("Now we are live with the express server");
});
@lexyblazy
lexyblazy / index.ts
Last active October 22, 2019 12:45
first firebase function
import * as functions from 'firebase-functions';
export const helloWorld = functions.https.onRequest((request, response) => {
response.send("Hello from Firebase!");
});
### Keybase proof
I hereby claim:
* I am lexyblazy on github.
* I am lexyblazy (https://keybase.io/lexyblazy) on keybase.
* I have a public key ASAMXZbrNaN9OqsxDy1vU_3OLlVXmK4AqmB2dqtB2haWDQo
To claim this, I am signing this object: