Skip to content

Instantly share code, notes, and snippets.

@jthegedus
Last active October 9, 2017 13:51
Show Gist options
  • Save jthegedus/d2174b51a83ca1e3e4153fe3a9ca768c to your computer and use it in GitHub Desktop.
Save jthegedus/d2174b51a83ca1e3e4153fe3a9ca768c to your computer and use it in GitHub Desktop.
Cloud Functions for Firebase - Express example 2/3 - using middleware
const functions = require("firebase-functions")
const cors = require("cors")
const express = require("express")
/* Express with CORS */
const app2 = express()
app2.use(cors({ origin: true }))
app2.get("*", (request, response) => {
response.send("Hello from Express on Firebase with CORS!")
})
const api2 = functions.https.onRequest(app2)
module.exports = {
api2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment