This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Get the imports | |
import { credential } from 'firebase-admin' | |
import { initializeApp } from 'firebase-admin/app' | |
import { getFirestore, CollectionReference, DocumentData } from 'firebase-admin/firestore' | |
// get the service account - IT SHOULD BE GIT IGNORED! | |
// Make one and download it here: | |
// https://console.firebase.google.com/u/0/project/your-project-name/settings/serviceaccounts/adminsdk | |
const serviceAccount = require('../../firebase-admin-service-account.json') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This Gist is part of a medium article - read here: | |
* https://jamiecurnow.medium.com/using-firestore-with-more-typescript-8058b6a88674 | |
*/ | |
// import firstore (obviously) | |
import { firestore } from "firebase-admin" | |
// Here's the helper type for paths: | |
type PathImpl<T, K extends keyof T> = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as admin from "firebase-admin" | |
import express from "express" | |
import sharp, { ResizeOptions, OutputOptions } from "sharp" | |
import fetch from "cross-fetch" | |
import FileType from "file-type" | |
import { parseQueryNumber, parseQueryString } from "../some/extra/util/functions" | |
import { Photo } from "../some/custom/types" | |
const router = express.Router() |