-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(firebase): added documentation to use firebase
- Loading branch information
Showing
7 changed files
with
84 additions
and
9 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
--- | ||
title: Firebase | ||
position: 3 | ||
description: See more about how to integrate with Firebase Functions. | ||
--- | ||
|
||
:::tip | ||
|
||
Don't know what a handler is? See the [Architecture](../architecture#handler) section. | ||
|
||
::: | ||
|
||
## Requirements | ||
|
||
First, install the types for this adapter: | ||
|
||
```bash | ||
npm i --save firebase-functions firebase-admin | ||
``` | ||
|
||
## Integrating with Http Events | ||
|
||
To use, you can import [HttpFirebaseHandler](../../api/Handlers/HttpFirebaseHandler) and call the method [setHandler](../../api/ServerlessAdapter#method-sethandler), as per the code below: | ||
|
||
```ts title="index.ts" | ||
import { ServerlessAdapter } from '@h4ad/serverless-adapter'; | ||
import { DummyAdapter } from '@h4ad/serverless-adapter/lib/adapters/dummy'; | ||
import { HttpFirebaseHandler } from '@h4ad/serverless-adapter/lib/handlers/firebase'; | ||
import { DummyResolver } from '@h4ad/serverless-adapter/lib/resolvers/dummy'; | ||
import app from './app'; | ||
|
||
export const helloWorld = ServerlessAdapter.new(app) | ||
.setHandler(new HttpFirebaseHandler()) | ||
.setResolver(new DummyResolver()) | ||
// choose the framework of your app | ||
// .setFramework(new ExpressFramework()) | ||
.addAdapter(new DummyAdapter()) | ||
.build(); | ||
|
||
// you can export more than one if you want | ||
export const test = ServerlessAdapter.new(app) | ||
.setHandler(new HttpFirebaseHandler()) | ||
.setResolver(new DummyResolver()) | ||
// choose the framework of your app | ||
// .setFramework(new ExpressFramework()) | ||
.addAdapter(new DummyAdapter()) | ||
.build(); | ||
``` | ||
|
||
:::info About Resolver and Adapter | ||
|
||
You should use DummyResolver and DummyAdapter because it's a requirement for the library, but HttpFirebaseHandler doesn't do anything with them, | ||
so you use those dummy versions just to satisfy the library requirements. | ||
|
||
::: | ||
|
||
## What about Cron, Pub/Sub, etc? | ||
|
||
I could not think yet in an API to handle those cases well, | ||
so currently I didn't add support to these type of Firebase Functions. | ||
|
||
If you have some idea about a design for those APIs, [create an issue](https://github.com/H4ad/serverless-adapter/issues/new/choose). | ||
|
||
## Examples | ||
|
||
You can see examples of how to use [here](https://github.com/H4ad/serverless-adapter-examples). | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
--- | ||
title: Huawei | ||
position: 3 | ||
position: 4 | ||
description: See more about how to integrate with Huawei. | ||
--- | ||
|
||
|
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
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