-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Audit and Fix All README.md Files #1224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 +1,32 @@ | ||
# http-flask | ||
# HTTP Flask Example | ||
|
||
This sample demonstrates how to expose a Flask app as a single Cloud Function. The Flask app provides a simple CRUD interface for "widgets" stored in the Realtime Database. | ||
|
||
## Functions Code | ||
|
||
See file [functions/main.py](functions/main.py) for the code. | ||
|
||
The sample creates a Flask app and defines two routes: | ||
|
||
- `GET /widgets` and `GET /widgets/<id>`: These routes retrieve a list of all widgets or a single widget by its ID from the Realtime Database. | ||
- `POST /widgets`: This route adds a new widget to the Realtime Database. | ||
|
||
The entire Flask app is then exposed as a single Cloud Function called `httpsflaskexample` using `@https_fn.on_request()`. | ||
|
||
## Trigger rules | ||
|
||
The `httpsflaskexample` function is triggered by an HTTP request. | ||
|
||
## Deploy and test | ||
|
||
To deploy and test the sample: | ||
|
||
1. Create a Firebase project on the [Firebase Console](https://console.firebase.google.com). | ||
2. Get the code, for instance using `git clone https://github.com/firebase/functions-samples` | ||
3. Enter the correct directory `cd functions-samples/Python/http-flask` | ||
4. Set up the CLI to use your Firebase project using `firebase use --add` and select your Firebase project. | ||
5. Deploy your project's code using `firebase deploy`. | ||
6. Use a tool like `curl` to test the function: | ||
- **Add a widget:** `curl -X POST -d "My new widget" https://us-central1-YOUR_PROJECT_ID.cloudfunctions.net/httpsflaskexample/widgets` | ||
- **Get all widgets:** `curl https://us-central1-YOUR_PROJECT_ID.cloudfunctions.net/httpsflaskexample/widgets` | ||
- **Get a specific widget:** `curl https://us-central1-YOUR_PROJECT_ID.cloudfunctions.net/httpsflaskexample/widgets/WIDGET_ID` |
This file contains hidden or 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 +1,33 @@ | ||
# post-signup-event | ||
# Post Sign-up Event with Google Calendar | ||
|
||
This sample demonstrates how to use an [Auth blocking function](https://firebase.google.com/docs/functions/auth-blocking-events) to save a user's Google OAuth2 access token to Firestore upon sign-up. It then uses a [task queue](https://firebase.google.com/docs/functions/task-functions) to schedule a Cloud Function that uses this token to create a Google Calendar event for the user. | ||
|
||
## Functions Code | ||
|
||
See file [functions/main.py](functions/main.py) for the code. | ||
|
||
The function `savegoogletoken` is an Auth blocking function that triggers before a user is created. If the user is signing up with Google, it saves their OAuth2 access token to a `user_info` collection in Firestore. It then creates a task to call the `scheduleonboarding` function. | ||
|
||
The `scheduleonboarding` function is a task queue function that retrieves the user's access token from Firestore, creates a new event on their primary Google Calendar, and then deletes the access token from Firestore. | ||
|
||
## Trigger rules | ||
|
||
- The `savegoogletoken` function is triggered by `beforeUserCreated` Auth blocking event. | ||
- The `scheduleonboarding` function is triggered by a task queue. | ||
|
||
## Deploy and test | ||
|
||
To deploy and test the sample: | ||
|
||
1. Create a Firebase project on the [Firebase Console](https://console.firebase.google.com). | ||
2. Enable the **Google Calendar API** for your project in the [Google Cloud Console](https://console.cloud.google.com/apis/library/calendar-json.googleapis.com). | ||
3. Enable blocking functions for your project in the Firebase console: | ||
- Go to the **Authentication** > **Settings** page. | ||
- In the **Blocking functions** section, select **Before user creation (beforeCreate)** from the dropdown menu. | ||
- Ensure that **Enable credential pass-through** is checked. | ||
4. Get the code, for instance using `git clone https://github.com/firebase/functions-samples` | ||
5. Enter the correct directory `cd functions-samples/Python/post-signup-event` | ||
6. Set up the CLI to use your Firebase project using `firebase use --add` and select your Firebase project. | ||
7. Deploy your project's code using `firebase deploy`. | ||
8. Sign up for your app using a Google account. | ||
9. After a minute, check your Google Calendar for a new "Onboarding with ExampleCo" event. |
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good suggestion! I've updated the title as you requested.