Created
January 17, 2020 16:09
-
-
Save Frenchcooc/b63912714b2ad9cd84c4b4c8d401fb37 to your computer and use it in GitHub Desktop.
Bearer Agent setup on Cloud Functions for Firebase
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
const Bearer = require('@bearer/node-agent') | |
Bearer.init({ secretKey: '...' }) | |
import * as functions from 'firebase-functions' | |
import axios from 'axios' | |
export const test = functions.https.onRequest((request, response) => { | |
response.send('Hello from Firebase!') | |
}) | |
export const starwars = functions.https.onRequest((request, response) => { | |
axios | |
.get('https://swapi.co/api/planets') | |
.then(res => { | |
response.send(res.data) | |
}) | |
.catch(console.error) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Make sure that
is at the top of your file 😇