Fable bindings for the firebase-functions npm package.
Stable | Prerelease |
---|---|
module Example.Handler
open Fable.FirebaseAdmin.Globals
open Fable.FirebaseFunctions
open Fable.FirebaseFunctions.Globals
// initialise the admin SDK
admin.initializeApp()
|> ignore
// Define a firebase function called 'test'
let test =
let handler (request : Request) (response : Response) =
response
.send("Testing is fun")
.``end``()
functions.https.onRequest(handler)
module Example.Application
open Fable.FirebaseAdmin.Globals
open Fable.FirebaseFunctions
open Fable.FirebaseFunctions.Globals
open Fable.Import
open Fable.Core.JsInterop
// initialise the admin SDK
admin.initializeApp()
|> ignore
// Create an express.js application
let private app = express.Invoke()
let private nameHandler =
fun (req : Request) (res : Response) _ ->
res.send("Jim Bob") |> box
let private ageHandler =
fun (req : Request) (res : Response) _ ->
res.send("23") |> box
// Add some endpoints
app.get(!^"/name", nameHandler) |> ignore
app.get(!^"/age", ageHandler) |> ignore
// Deploy the application as a cloud function at /api
let api = Globals.functions.https.onRequest(app)
Make sure the following requirements are installed in your system:
- dotnet SDK 2.0 or higher
- node.js 6.11 or higher
- yarn
- Mono if you're on Linux or macOS.
Then you just need to type ./build.cmd
or ./build.sh
In order to push the package to nuget.org you need to add your API keys to NUGET_KEY
environmental variable.
You can create a key here.
- Update RELEASE_NOTES with a new version, data and release notes ReleaseNotesHelper. Ex:
#### 0.2.0 - 30.04.2017
* FEATURE: Does cool stuff!
* BUGFIX: Fixes that silly oversight
- You can then use the Release target. This will:
- make a commit bumping the version: Bump version to 0.2.0
- publish the package to nuget
- push a git tag
./build.sh Release