-
Notifications
You must be signed in to change notification settings - Fork 1
Changes for updated link on capella and some minor changes in readme #12
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,35 @@ | ||
| # Couchbase Data API Tutorial | ||
| # Couchbase Data API Serverless Cookbook | ||
|
|
||
| This tutorial demonstrates how to work with Couchbase's Data API to manage airport data from the travel-sample dataset. | ||
| > ** Important:** This cookbook demonstrates building **serverless REST APIs** that use **Couchbase Data API** under the hood. Your applications interact with standard REST endpoints, while the serverless functions handle all communication with Couchbase's Data API internally. | ||
|
|
||
| This cookbook demonstrates how to build serverless REST APIs across multiple cloud platforms (AWS Lambda, Azure Functions, Cloudflare Workers, and Google Cloud Functions) that interface with Couchbase's Data API to manage airport data from the travel-sample dataset. | ||
|
|
||
| ## Overview | ||
|
|
||
| This provides a comprehensive Airport Information System that manages airport data and provides related travel information from the Couchbase travel-sample dataset. | ||
| This cookbook provides a comprehensive Airport Information System that manages airport data and provides related travel information from the Couchbase travel-sample dataset. Each serverless implementation exposes REST API endpoints that internally call Couchbase's Data API, following REST API principles while abstracting the underlying Data API interactions. | ||
|
|
||
| ### Architecture | ||
|
|
||
| The serverless functions act as a REST API layer that interfaces with Couchbase Data API. Here's how the request flow works: | ||
|
|
||
| **REST API Flow:** | ||
| 1. **Client Request**: Your application sends a standard HTTP request to the REST API endpoint (e.g., `POST /airports`) | ||
| 2. **Serverless Function Layer**: | ||
| - Receives and validates the incoming HTTP request | ||
| - Extracts required parameters (path parameters, query strings, request body) | ||
| - Performs business logic and data transformation | ||
| - Authenticates with Couchbase Data API using stored credentials | ||
| 3. **Couchbase Data API Call**: The serverless function makes an HTTP request to Couchbase's Data API endpoint with proper authentication headers | ||
| 4. **Response Processing**: The serverless function receives the Data API response, formats it appropriately, and returns it to the client | ||
|
|
||
| ### Learn More About Couchbase Data API | ||
|
|
||
| This cookbook's serverless functions are built on top of Couchbase's Data API. To learn more about the underlying API: | ||
|
|
||
| - **[Get Started with Data API](https://docs.couchbase.com/cloud/data-api-guide/data-api-start.html)** - Complete guide covering setup, authentication, and networking options | ||
| - **[Data API Reference](https://docs.couchbase.com/cloud/data-api-reference/index.html)** - Full API reference for all available endpoints (document operations, queries, search, etc.) | ||
|
|
||
| Understanding these resources will help you extend the serverless functions or build custom integrations. | ||
|
|
||
| ## Platform Tutorials | ||
|
|
||
|
|
@@ -36,12 +61,20 @@ Choose your preferred serverless platform to get started: | |
|
|
||
| ## Prerequisites | ||
|
|
||
| - [Couchbase Capella](https://www.couchbase.com/products/capella/) cluster with Data API enabled | ||
| - Couchbase [travel-sample](https://docs.couchbase.com/dotnet-sdk/current/ref/travel-app-data-model.html) bucket loaded | ||
| - [Couchbase Capella](https://www.couchbase.com/products/capella/) cluster | ||
| - Couchbase [travel-sample](https://docs.couchbase.com/cloud/clusters/data-service/import-data-documents.html) bucket loaded | ||
|
|
||
| ## Database Configuration | ||
|
|
||
| ### Enable the Data API | ||
|
|
||
| Before you can use this cookbook, you must enable the Data API for your Couchbase Capella cluster. Follow the instructions in the [Couchbase documentation](https://docs.couchbase.com/cloud/data-api-guide/data-api-start.html#enable-the-data-api) to: | ||
|
|
||
| 1. Enable the Data API for your cluster | ||
| 2. Copy the Data API endpoint URL (you'll need this for `DATA_API_ENDPOINT`) | ||
|
|
||
| ### Setup Database Connection | ||
|
|
||
| To connect to your Capella cluster, please follow the [instructions](https://docs.couchbase.com/cloud/get-started/connect.html). | ||
|
|
||
| Specifically, you need to do the following: | ||
|
|
@@ -51,9 +84,9 @@ Specifically, you need to do the following: | |
|
|
||
| ### Required Environment Variables | ||
| The following Couchbase Data API credentials are required: | ||
| - `DATA_API_USERNAME` - Your Couchbase database username | ||
| - `DATA_API_PASSWORD` - Your Couchbase database password | ||
| - `DATA_API_ENDPOINT` - Your Couchbase Data API endpoint URL | ||
| - `DATA_API_USERNAME` - Your Couchbase database username (from the database credentials created in step 1 above) | ||
| - `DATA_API_PASSWORD` - Your Couchbase database password (from the database credentials created in step 1 above) | ||
| - `DATA_API_ENDPOINT` - Your Couchbase Data API endpoint URL (obtained when enabling the Data API) | ||
|
|
||
| ## FTS Index Setup | ||
|
|
||
|
|
@@ -65,9 +98,11 @@ A common Node.js script is provided to create the required geo-spatial FTS index | |
|
|
||
|
|
||
|
|
||
| ## API Examples | ||
| ## REST API Endpoints & Usage Examples | ||
|
|
||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. repetitive |
||
| > **Note:** These are the **REST API endpoints** that your client applications will use. Behind the scenes, the serverless functions translate these REST calls into Couchbase Data API requests, handling authentication and data transformation automatically. | ||
|
|
||
| The following examples demonstrate the API endpoints that interface with Couchbase's Data API: | ||
| The following examples demonstrate how to interact with the REST API endpoints: | ||
|
|
||
| ### Get an airport | ||
| ```bash | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -27,8 +27,8 @@ Once deployed, the API Gateway will provide the following endpoints: | |||||
| - [Node.js](https://nodejs.org/) (v18.x or later) | ||||||
| - [AWS CLI](https://aws.amazon.com/cli/) configured with appropriate credentials | ||||||
| - [Serverless Framework](https://www.serverless.com/) (will be installed as dev dependency) | ||||||
| - [Couchbase Capella](https://www.couchbase.com/products/capella/) cluster with Data API enabled | ||||||
| - Couchbase [travel-sample bucket](https://docs.couchbase.com/dotnet-sdk/current/ref/travel-app-data-model.html) loaded | ||||||
| - [Couchbase Capella](https://www.couchbase.com/products/capella/) cluster with [Data API enabled](https://docs.couchbase.com/cloud/data-api-guide/data-api-start.html#enable-the-data-api) | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For consistency with the main Consider also adding a step in the
Suggested change
|
||||||
| - Couchbase [travel-sample bucket](https://docs.couchbase.com/cloud/clusters/data-service/import-data-documents.html) loaded | ||||||
|
|
||||||
| ## Setup | ||||||
|
|
||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -13,8 +13,8 @@ This project demonstrates how to build an Azure Functions-based API that interfa | |||||
| - [Azure CLI](https://docs.microsoft.com/en-us/cli/azure/) configured with appropriate credentials | ||||||
| - [Azure Functions Core Tools](https://docs.microsoft.com/en-us/azure/azure-functions/functions-run-local) (v4.x) | ||||||
| - Azure subscription with Functions and API Management permissions | ||||||
| - [Couchbase Capella](https://www.couchbase.com/products/capella/) cluster with Data API enabled | ||||||
| - Couchbase [travel-sample](https://docs.couchbase.com/dotnet-sdk/current/ref/travel-app-data-model.html) bucket loaded | ||||||
| - [Couchbase Capella](https://www.couchbase.com/products/capella/) cluster with [Data API enabled](https://docs.couchbase.com/cloud/data-api-guide/data-api-start.html#enable-the-data-api) | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To maintain consistency with the main
Suggested change
|
||||||
| - Couchbase [travel-sample](https://docs.couchbase.com/cloud/clusters/data-service/import-data-documents.html) bucket loaded | ||||||
|
|
||||||
| ## Setup | ||||||
|
|
||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -12,8 +12,8 @@ This project demonstrates how to build a Cloudflare Workers-based API using the | |||||
| - [Node.js](https://nodejs.org/) (v20 or later) | ||||||
| - [Wrangler CLI](https://developers.cloudflare.com/workers/wrangler/install-and-update/) | ||||||
| - [Cloudflare account](https://dash.cloudflare.com/) with verified email | ||||||
| - [Couchbase Capella](https://www.couchbase.com/products/capella/) cluster with Data API enabled | ||||||
| - Couchbase [travel-sample](https://docs.couchbase.com/dotnet-sdk/current/ref/travel-app-data-model.html) bucket loaded | ||||||
| - [Couchbase Capella](https://www.couchbase.com/products/capella/) cluster with [Data API enabled](https://docs.couchbase.com/cloud/data-api-guide/data-api-start.html#enable-the-data-api) | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For better consistency with the refactored main
Suggested change
|
||||||
| - Couchbase [travel-sample](https://docs.couchbase.com/cloud/clusters/data-service/import-data-documents.html) bucket loaded | ||||||
|
|
||||||
| ## Setup | ||||||
|
|
||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -12,8 +12,8 @@ This project demonstrates how to build a serverless API using **[GCP Cloud Funct | |||||
| - [Node.js](https://nodejs.org/) (v22.x or later) | ||||||
| - [Google Cloud CLI](https://cloud.google.com/sdk/docs/install) configured with appropriate credentials. | ||||||
| - Google Cloud Project with Cloud Functions and API Gateway with [services enabled.](https://cloud.google.com/api-gateway/docs/secure-traffic-gcloud#enabling_required_services) | ||||||
| - [Couchbase Capella](https://www.couchbase.com/products/capella/) cluster with Data API enabled. | ||||||
| - Couchbase [travel-sample](https://docs.couchbase.com/dotnet-sdk/current/ref/travel-app-data-model.html) bucket loaded. | ||||||
| - [Couchbase Capella](https://www.couchbase.com/products/capella/) cluster with [Data API enabled](https://docs.couchbase.com/cloud/data-api-guide/data-api-start.html#enable-the-data-api). | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To align with the structure of the main Consider also adding a step in the
Suggested change
|
||||||
| - Couchbase [travel-sample](https://docs.couchbase.com/cloud/clusters/data-service/import-data-documents.html) bucket loaded. | ||||||
|
|
||||||
| ## Setup | ||||||
|
|
||||||
|
|
||||||
Uh oh!
There was an error while loading. Please reload this page.
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.
"This cookbook demonstrates how to build serverless REST APIs across multiple cloud platforms (AWS Lambda, Azure Functions, Cloudflare Workers, and Google Cloud Functions) that interface with Couchbase's Data API to manage airport data from the travel-sample dataset."
Most of it sounds repetitive with the previous lines. Would the simplified versionbelow work ?
It includes examples for AWS Lambda, Azure Functions, Cloudflare Workers, and Google Cloud Functions, using airport data from the travel-sample dataset.