This file contains hidden or 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
/* | |
fetch is awesome, there's no question about it. | |
But aren't you tired of: | |
- Writing your `res => res.json()` handler | |
- Having to stringify your body | |
- Signin your request with the same headers (```{'Content-Type': json, Authorization: 'JWT ...'}```) | |
- Inconsistently handling the response status code and not reject promise when relevant. | |
Usage: | |
request('http://yourawesome.api.com').then(console.log).catch(console.error); |
This file contains hidden or 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 functions from 'firebase-functions'; | |
import * as admin from "firebase-admin"; | |
import * as puppeteer from "puppeteer"; | |
admin.initializeApp() | |
export const takeGoogleScreenshot = functions | |
.runWith({ memory: "1GB" }) | |
.https.onRequest(async (request, response) => { | |
const browser = await puppeteer.launch({ |
OlderNewer