Skip to content

Instantly share code, notes, and snippets.

@Frenchcooc
Created January 17, 2020 16:09
Show Gist options
  • Save Frenchcooc/b63912714b2ad9cd84c4b4c8d401fb37 to your computer and use it in GitHub Desktop.
Save Frenchcooc/b63912714b2ad9cd84c4b4c8d401fb37 to your computer and use it in GitHub Desktop.
Bearer Agent setup on Cloud Functions for Firebase
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)
})
@Frenchcooc
Copy link
Author

Frenchcooc commented Jan 17, 2020

Make sure that

const Bearer = require('@bearer/node-agent')
Bearer.init({ secretKey: '...' })

is at the top of your file 😇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment