Created
November 2, 2022 21:26
-
-
Save buren/68e909e0cb91d4279b7145a1e018ab0f to your computer and use it in GitHub Desktop.
httpbin built with on a firebase function stored in firestore
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 { firestore } from 'firebase-admin'; | |
import * as functions from 'firebase-functions'; | |
const region = 'europe-west1'; | |
const firestoreCollection = 'webhook-posts'; | |
export const httpBin = functions | |
.region(region) | |
.https.onRequest(async ({ headers, body }, response) => { | |
const data = { headers, body }; | |
await firestore().collection(firestoreCollection).doc().create(data); | |
response.setHeader('Content-Type', 'application/json'); | |
response.send(JSON.stringify(data)); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment