Last active
January 15, 2020 21:26
-
-
Save tianhaoz95/f108f4c91f44054f1c35c979fed5ff5f to your computer and use it in GitHub Desktop.
External version of Firebase API
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
export const externalAwesomeAPI = functions.https.onRequest(async (req, res) => { | |
if (req.method !== "POST") { | |
return res.sendStatus(403); | |
} | |
const context: FunctionContext = await token2context(req.body.token); | |
const intermediateRequest: IntermediateRequestInterface = parseIntermediateRequest(req.body); | |
try { | |
await awesomeHandler(intermediateRequest, context); | |
return res.sendStatus(200); | |
} catch (err) { | |
return res.sendStatus(500); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment