{"id":10369,"date":"2024-05-10T01:15:26","date_gmt":"2024-05-10T08:15:26","guid":{"rendered":"https:\/\/www.couchbase.com\/developers\/tutorials\/quickstart-nextjs-capella\/"},"modified":"2024-05-10T01:15:26","modified_gmt":"2024-05-10T08:15:26","slug":"quickstart-nextjs-capella","status":"publish","type":"tutorials","link":"https:\/\/www.couchbase.com\/it\/developers\/tutorials\/quickstart-nextjs-capella\/","title":{"rendered":"Using Next.js with Couchbase NodeJS SDK"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">In this tutorial, you will learn how to connect to a Couchbase Capella cluster to create, read, update, and delete documents and how to write simple parametrized SQL++ queries.<\/p>\n\n\n\n<h3 id=\"h-prerequisites\" class=\"wp-block-heading\">Prerequisites<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">To run this prebuilt project, you will need:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\n<p><a href=\"https:\/\/www.couchbase.com\/products\/capella\/\">Couchbase Capella<\/a> cluster with <a href=\"https:\/\/docs.couchbase.com\/nodejs-sdk\/current\/ref\/travel-app-data-model.html\">travel-sample<\/a> bucket loaded.<\/p>\n<ul>\n<li>To run this tutorial using a self managed Couchbase cluster, please refer to the <a href=\"#running-self-managed-couchbase-cluster\">appendix<\/a>.<\/li>\n<\/ul>\n<\/li>\n\n\n<li>\n<p><a href=\"https:\/\/nextjs.org\/\">Next.js<\/a> 14 or higher installed<\/p>\n<\/li>\n\n\n<li>\n<p>Loading Travel Sample Bucket\nIf travel-sample is not loaded in your Capella cluster, you can load it by following the instructions for your Capella Cluster:<\/p>\n<ul>\n<li><a href=\"https:\/\/docs.couchbase.com\/cloud\/clusters\/data-service\/import-data-documents.html#import-sample-data\">Load travel-sample bucket in Couchbase Capella<\/a><\/li>\n<\/ul>\n<\/li>\n\n<\/ul>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">Note that this tutorial is designed to work with the latest <a href=\"https:\/\/docs.couchbase.com\/nodejs-sdk\/current\/hello-world\/overview.html\">Node.js SDK (4.x)<\/a> for Couchbase. It will not work with older versions of Next.js without adapting the code.<\/p>\n<\/blockquote>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\n<p>Ensure that the Nodejs version is <a href=\"https:\/\/docs.couchbase.com\/nodejs-sdk\/current\/project-docs\/compatibility.html\">compatible<\/a> with the Couchbase SDK.<\/p>\n<\/li>\n\n\n<li>\n<p>Loading Travel Sample Bucket\nIf travel-sample is not loaded in your Capella cluster, you can load it by following the instructions for your Capella Cluster:<\/p>\n<ul>\n<li><a href=\"https:\/\/docs.couchbase.com\/cloud\/clusters\/data-service\/import-data-documents.html#import-sample-data\">Load travel-sample bucket in Couchbase Capella<\/a><\/li>\n<\/ul>\n<\/li>\n\n<\/ul>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">Note that this tutorial is designed to work with Next.js 14. Please make sure you have Next.js 14 installed before proceeding.<\/p>\n<\/blockquote>\n\n\n\n<h3 id=\"h-app-setup\" class=\"wp-block-heading\">App Setup<\/h3>\n\n\n\n<h4 id=\"h-cloning-repo\" class=\"wp-block-heading\">Cloning Repo<\/h4>\n\n\n\n<pre class=\"wp-block-code language-shell\"><code>git clone https:\/\/github.com\/couchbase-examples\/nextjs-capella-quickstart.git\n<\/code><\/pre>\n\n\n\n<h4 id=\"h-install-dependencies\" class=\"wp-block-heading\">Install Dependencies<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Any dependencies should be installed through the node package manager (npm). Navigate to the root directory and run the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code language-shell\"><code>npm install\n<\/code><\/pre>\n\n\n\n<h4 id=\"h-setup-database-configuration\" class=\"wp-block-heading\">Setup Database Configuration<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">To know more about connecting to your Capella cluster, please follow the <a href=\"https:\/\/docs.couchbase.com\/cloud\/get-started\/connect.html\">instructions<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Specifically, you need to do the following:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Create the <a href=\"https:\/\/docs.couchbase.com\/cloud\/clusters\/manage-database-users.html\">database credentials<\/a> to access the travel-sample bucket (Read and Write) used in the application.<\/li>\n\n\n<li><a href=\"https:\/\/docs.couchbase.com\/cloud\/clusters\/allow-ip-address.html\">Allow access<\/a> to the Cluster from the IP on which the application is running.<\/li>\n\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">All configuration for communication with the database is fetched from the environment variables. We have provided a convenience feature in this quickstart to read the environment variables from a local file, <code>.env<\/code> in the source folder.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Create a copy of <code>.env.example<\/code> file &amp; rename it to <code>.env.local<\/code> &amp; add the values for the Couchbase cluster.<\/p>\n\n\n\n<pre class=\"wp-block-code language-sh\"><code>DB_CONN_STR=&lt;connection_string&gt;\nDB_USERNAME=&lt;user_with_read_write_permission_to_travel-sample_bucket&gt;\nDB_PASSWORD=&lt;password_for_user&gt;\n<\/code><\/pre>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">Note: The connection string expects the <code>couchbases:\/\/<\/code> or <code>couchbase:\/\/<\/code> part.<\/p>\n<\/blockquote>\n\n\n\n<h3 id=\"h-running-the-application\" class=\"wp-block-heading\">Running the Application<\/h3>\n\n\n\n<h4 id=\"h-directly-on-local-machine\" class=\"wp-block-heading\">Directly on Local Machine<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">At this point, we have installed the dependencies, loaded the travel-sample data and configured the application with the credentials. The application is now ready and you can run it.<\/p>\n\n\n\n<pre class=\"wp-block-code language-sh\"><code>npm run dev\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The application will start on port 3000 of your local machine (<a href=\"http:\/\/localhost:3000\">http:\/\/localhost:3000<\/a>).\nThe interactive Swagger documentation of the API can be found at <a href=\"http:\/\/localhost:3000\/api-doc\">http:\/\/localhost:3000\/api-doc<\/a>.<\/p>\n\n\n\n<h5 id=\"h-using-docker\" class=\"wp-block-heading\">Using Docker<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\">If you prefer to run this quick start using Docker, we have provided the Dockerfile which you can use to build the image and run the API as a container.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Build the Docker image<\/li>\n\n<\/ul>\n\n\n\n<pre class=\"wp-block-code language-sh\"><code>docker build -t nextjs-capella-quickstart . -f Dockerfile.dev\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Run the Docker image<\/li>\n\n<\/ul>\n\n\n\n<pre class=\"wp-block-code language-sh\"><code>docker run -p 3000:3000 nextjs-capella-quickstart -e DB_CONN_STR=&lt;connection_string&gt; -e DB_USERNAME=&lt;user_with_read_write_permission_to_travel-sample_bucket&gt; -e DB_PASSWORD=&lt;password_for_user&gt;\n<\/code><\/pre>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">Note: The <code>dev.env<\/code> file has the environment variables for the application. The <code>-e<\/code> flag is used to pass the environment variables to the container.<\/p>\n<\/blockquote>\n\n\n\n<h4 id=\"h-verifying-the-application\" class=\"wp-block-heading\">Verifying the Application<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Once the application starts, you can see the details of the application on the logs.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><img decoding=\"async\" src=\".\/nextjs_capella_app_startup.png\" alt=\"Application Startup\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The application will run on port 3000 of your local machine (<a href=\"http:\/\/localhost:3000\">http:\/\/localhost:3000<\/a>). You will find the interactive Swagger documentation of the API if you go to the URL(<a href=\"http:\/\/localhost:3000\/api-doc\">http:\/\/localhost:3000\/api-doc<\/a>) in your browser. Swagger documentation is used in this demo to showcase the different API end points and how they can be invoked. More details on the Swagger documentation can be found in the <a href=\"#swagger-documentation\">appendix<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><img decoding=\"async\" src=\".\/nextjs_capella_swagger_documentation.png\" alt=\"Swagger Documentation\"><\/p>\n\n\n\n<h3 id=\"h-data-model\" class=\"wp-block-heading\">Data Model<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">For this tutorial, we use three collections, <code>airport<\/code>, <code>airline<\/code> and <code>route<\/code> that contain sample airports, airlines and airline routes respectively. The route collection connects the airports and airlines as seen in the figure below. We use these connections in the quickstart to generate airports that are directly connected and airlines connecting to a destination airport. Note that these are just examples to highlight how you can use SQL++ queries to join the collections.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><img decoding=\"async\" src=\".\/travel_sample_data_model.png\" alt=\"img\"><\/p>\n\n\n\n<h3 id=\"h-let-us-review-the-code\" class=\"wp-block-heading\">Let Us Review the Code<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">To begin this tutorial, clone the repo and open it up in the IDE of your choice. Now you can learn about how to create, read, update and delete documents in Couchbase Server.<\/p>\n\n\n\n<h4 id=\"h-code-layout\" class=\"wp-block-heading\">Code Layout<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>Dockerfile.dev\napp\n\u251c\u2500\u2500 api\n\u2502   \u251c\u2500\u2500 hello\n\u2502   \u2502   \u2514\u2500\u2500 route.ts\n\u2502   \u2514\u2500\u2500 v1\n\u2502       \u251c\u2500\u2500 airline\n\u2502       \u2502   \u251c\u2500\u2500 [airlineId]\n\u2502       \u2502   \u2502   \u251c\u2500\u2500 route.test.ts\n\u2502       \u2502   \u2502   \u2514\u2500\u2500 route.ts\n\u2502       \u2502   \u251c\u2500\u2500 list\n\u2502       \u2502   \u2502   \u251c\u2500\u2500 route.test.ts\n\u2502       \u2502   \u2502   \u2514\u2500\u2500 route.ts\n\u2502       \u2502   \u2514\u2500\u2500 to-airport\n\u2502       \u2502       \u251c\u2500\u2500 route.test.ts\n\u2502       \u2502       \u2514\u2500\u2500 route.ts\n\u2502       \u251c\u2500\u2500 airport\n\u2502       \u2502   \u251c\u2500\u2500 [airportId]\n\u2502       \u2502   \u2502   \u251c\u2500\u2500 route.test.ts\n\u2502       \u2502   \u2502   \u2514\u2500\u2500 route.ts\n\u2502       \u2502   \u2514\u2500\u2500 direct-connections\n\u2502       \u2502       \u251c\u2500\u2500 route.test.ts\n\u2502       \u2502       \u2514\u2500\u2500 route.ts\n\u2502       \u2514\u2500\u2500 route\n\u2502           \u2514\u2500\u2500 [routeId]\n\u2502               \u251c\u2500\u2500 route.test.ts\n\u2502               \u2514\u2500\u2500 route.ts\n\u251c\u2500\u2500 api-doc\n\u2502   \u251c\u2500\u2500 page.tsx\n\u2502   \u2514\u2500\u2500 react-swagger.tsx\n\u251c\u2500\u2500 layout.tsx\n\u251c\u2500\u2500 models\n\u2502   \u251c\u2500\u2500 Airline.ts\n\u2502   \u251c\u2500\u2500 Airport.ts\n\u2502   \u2514\u2500\u2500 Route.ts\n\u2514\u2500\u2500 page.tsx\n<\/code><\/pre>\n\n\n\n<h4 id=\"h-connecting-to-couchbase\" class=\"wp-block-heading\">Connecting to Couchbase<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">We use the Couchbase Node.js SDK to connect to the Couchbase cluster. The connection is established in the <code>couchbase-connection.ts<\/code> file in the <code>lib<\/code> folder. The connection string and credentials are read from the environment variables.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here is the code to connect to the Couchbase cluster:<\/p>\n\n\n\n<pre class=\"wp-block-code language-ts\"><code>interface DbConnection {\n  cluster: couchbase.Cluster;\n  bucket: couchbase.Bucket;\n  scope: couchbase.Scope;\n  airlineCollection: couchbase.Collection;\n  airportCollection: couchbase.Collection;\n  routeCollection: couchbase.Collection;\n}\n\nlet cachedDbConnection: DbConnection | null = null;\n\ndeclare const global: {\n  couchbase?: {\n    conn: couchbase.Cluster | null;\n  };\n};\n\n\/**\n * Global is used here to maintain a cached connection across hot reloads\n * in development. This prevents connections growing exponentially\n * during API Route usage.\n *\/\nlet cached: { conn: couchbase.Cluster | null } = global.couchbase ?? {\n  conn: null,\n};\n\nasync function createCouchbaseCluster(): Promise&lt;couchbase.Cluster&gt; {\n  if (cached.conn) {\n    return cached.conn;\n  }\n  const cluster = await couchbase.connect(DB_CONN_STR, {\n    username: DB_USERNAME,\n    password: DB_PASSWORD,\n    configProfile: &quot;wanDevelopment&quot;,\n  });\n\n  cached.conn = cluster;\n  return cluster;\n}\n\nasync function connectToDatabase(): Promise&lt;DbConnection&gt; {\n  const cluster = await createCouchbaseCluster();\n  const bucket = cluster.bucket(DB_BUCKET_NAME);\n  const scope = bucket.scope(&quot;inventory&quot;);\n  const airlineCollection = scope.collection(&quot;airline&quot;);\n  const airportCollection = scope.collection(&quot;airport&quot;);\n  const routeCollection = scope.collection(&quot;route&quot;);\n\n  const dbConnection: DbConnection = {\n    cluster,\n    bucket,\n    scope,\n    airlineCollection,\n    airportCollection,\n    routeCollection,\n  };\n  cachedDbConnection = dbConnection;\n  return dbConnection;\n}\n\nexport function getDatabase(): Promise&lt;DbConnection&gt; {\n  if (!cachedDbConnection) {\n    \/\/ If connection doesn&#039;t exist, create and cache it\n    return connectToDatabase();\n  }\n  \/\/ If connection exists, return it\n  return Promise.resolve(cachedDbConnection);\n}\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">In the <code>connectToDatabase<\/code> function, we connect to the Couchbase cluster using the connection string and credentials. We then connect to the <code>travel-sample<\/code> bucket and create references to the collections we will be using in the application.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In the <code>getDatabase<\/code> function, we check if the connection exists and return it. If it doesn&#8217;t exist, we create and cache it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We use the global object to maintain a cached connection across hot reloads in development. This prevents connections from growing exponentially during API route usage.<\/p>\n\n\n\n<h4 id=\"h-airline-entity\" class=\"wp-block-heading\">Airline Entity<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">For this tutorial, we will focus on the airline entity. The other entities are similar.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We will be setting up a REST API to manage airline documents.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"#get-airline\">GET Airline<\/a> \u2013 Read specified airline<\/li>\n\n\n<li><a href=\"#post-airline\">POST Airline<\/a> \u2013 Create a new airline<\/li>\n\n\n<li><a href=\"#put-airline\">PUT Airline<\/a> \u2013 Update specified airline<\/li>\n\n\n<li><a href=\"#delete-airline\">DELETE Airline<\/a> \u2013 Delete airline<\/li>\n\n\n<li><a href=\"#list-airline\">Airline List<\/a> \u2013 Get all airlines. Optionally filter the list by country<\/li>\n\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">For CRUD operations, we will use the <a href=\"https:\/\/docs.couchbase.com\/nodejs-sdk\/current\/howtos\/kv-operations.html\">Key-Value operations<\/a> that are built into the Couchbase SDK to create, read, update, and delete a document. Every document will need an ID (similar to a primary key in other databases) to save it to the database. This ID is passed in the URL. For other end points, we will use <a href=\"https:\/\/docs.couchbase.com\/nodejs-sdk\/current\/howtos\/n1ql-queries-with-sdk.html\">SQL++<\/a> to query for documents.<\/p>\n\n\n\n<h4 id=\"h-airline-document-structure\" class=\"wp-block-heading\">Airline Document Structure<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Our profile document will have an airportname, city, country, faa code, icao code, timezone info and the geographic coordinates. For this demo, we will store all airport information in one document in the <code>airline<\/code> collection in the <code>travel-sample<\/code> bucket.<\/p>\n\n\n\n<pre class=\"wp-block-code language-json\"><code>{\n  &quot;name&quot;: &quot;40-Mile Air&quot;,\n  &quot;iata&quot;: &quot;Q5&quot;,\n  &quot;icao&quot;: &quot;MLA&quot;,\n  &quot;callsign&quot;: &quot;MILE-AIR&quot;,\n  &quot;country&quot;: &quot;United States&quot;\n}\n<\/code><\/pre>\n\n\n\n<h4 id=\"h-get-airline\" class=\"wp-block-heading\">GET Airline<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">In the <code>GET<\/code> method, we use the <code>get<\/code> method of the <code>airlineCollection<\/code> to fetch the document with the specified ID. If the document is not found, we return a 404 status code. If an error occurs, we return a 500 status code.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If the document is found, we return the document as a JSON response with a 200 status code.<\/p>\n\n\n\n<pre class=\"wp-block-code language-ts\"><code>export async function GET(\n  req: NextRequest,\n  { params }: { params: { airlineId: string } }\n) {\n  try {\n    const { airlineId } = params;\n    const { airlineCollection } = await getDatabase();\n\n    const airline = await airlineCollection.get(airlineId);\n    return NextResponse.json(airline.content as TAirline, { status: 200 });\n  } catch (error) {\n    if (error instanceof DocumentNotFoundError) {\n      return NextResponse.json(\n        { message: &quot;Airline not found&quot;, error: &quot;Airline not found&quot; },\n        { status: 404 }\n      );\n    } else {\n      return NextResponse.json(\n        {\n          message: &quot;An error occurred while fetching airline&quot;,\n        },\n        { status: 500 }\n      );\n    }\n  }\n}\n<\/code><\/pre>\n\n\n\n<h4 id=\"h-post-airline\" class=\"wp-block-heading\">POST Airline<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">In the <code>POST<\/code> method, we use the <code>insert<\/code> method of the <code>airlineCollection<\/code> to create a new document with the specified ID. If the document already exists, we return a 409 status code. If the request body is invalid, we return a 400 status code. If an error occurs, we return a 500 status code.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If the document is created successfully, we return the document as a JSON response with a 201 status code.<\/p>\n\n\n\n<pre class=\"wp-block-code language-ts\"><code>export async function POST(\n  req: NextRequest,\n  { params }: { params: { airlineId: string } }\n) {\n  try {\n    const { airlineId } = params;\n    const airlineData: TAirline = await req.json();\n    const parsedAirlineData = AirlineSchema.parse(airlineData);\n    const { airlineCollection } = await getDatabase();\n\n    const createdAirline = await airlineCollection.insert(\n      airlineId,\n      parsedAirlineData\n    );\n    return NextResponse.json(\n      {\n        airlineId: airlineId,\n        airlineData: parsedAirlineData,\n        createdAirline: createdAirline,\n      },\n      {\n        status: 201,\n      }\n    );\n  } catch (error) {\n    if (error instanceof DocumentExistsError) {\n      return NextResponse.json(\n        {\n          message: &quot;Airline already exists&quot;,\n          error: &quot;Airline already exists&quot;,\n        },\n        { status: 409 }\n      );\n    } else if (error instanceof ZodError) {\n      return NextResponse.json(\n        {\n          message: &quot;Invalid request body&quot;,\n          error: error.errors,\n        },\n        { status: 400 }\n      );\n    } else {\n      return NextResponse.json(\n        {\n          message: &quot;An error occurred while creating airline&quot;,\n        },\n        { status: 500 }\n      );\n    }\n  }\n}\n<\/code><\/pre>\n\n\n\n<h4 id=\"h-put-airline\" class=\"wp-block-heading\">PUT Airline<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">In the <code>PUT<\/code> method, we use the <code>upsert<\/code> method of the <code>airlineCollection<\/code> to update the document with the specified ID. If the document does not exist, it is created. If the request body is invalid, we return a 400 status code. If an error occurs, we return a 500 status code.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If the document is updated successfully, we return the document as a JSON response with a 200 status code.<\/p>\n\n\n\n<pre class=\"wp-block-code language-ts\"><code>export async function PUT(\n  req: NextRequest,\n  { params }: { params: { airlineId: string } }\n) {\n  try {\n    const { airlineId } = params;\n    const airlineData: TAirline = await req.json();\n    const parsedAirlineData = AirlineSchema.parse(airlineData);\n    const { airlineCollection } = await getDatabase();\n\n    const updatedAirline = await airlineCollection.upsert(\n      airlineId,\n      parsedAirlineData\n    );\n    return NextResponse.json(\n      {\n        airlineId: airlineId,\n        airlineData: parsedAirlineData,\n        updatedAirline: updatedAirline,\n      },\n      { status: 200 }\n    );\n  } catch (error) {\n    if (error instanceof ZodError) {\n      return NextResponse.json(\n        { message: &quot;Invalid request body&quot;, error: error.errors },\n        { status: 400 }\n      );\n    } else {\n      return NextResponse.json(\n        {\n          message: &quot;An error occurred while updating airline&quot;,\n          error: &quot;An error occurred while updating airline&quot;,\n        },\n        { status: 500 }\n      );\n    }\n  }\n}\n<\/code><\/pre>\n\n\n\n<h4 id=\"h-delete-airline\" class=\"wp-block-heading\">DELETE Airline<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">In the <code>DELETE<\/code> method, we use the <code>remove<\/code> method of the <code>airlineCollection<\/code> to delete the document with the specified ID. If the document is not found, we return a 404 status code. If an error occurs, we return a 500 status code.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If the document is deleted successfully, we return a JSON response with a 202 status code.<\/p>\n\n\n\n<pre class=\"wp-block-code language-ts\"><code>export async function DELETE(\n  req: NextRequest,\n  { params }: { params: { airlineId: string } }\n) {\n  try {\n    const { airlineId } = params;\n    const { airlineCollection } = await getDatabase();\n\n    await airlineCollection.remove(airlineId);\n    return NextResponse.json(\n      { message: &quot;Successfully deleted airline&quot; },\n      { status: 202 }\n    );\n  } catch (error) {\n    if (error instanceof DocumentNotFoundError) {\n      return NextResponse.json(\n        {\n          message: &quot;Airline not found&quot;,\n          error: &quot;Airline not found&quot;,\n        },\n        { status: 404 }\n      );\n    } else {\n      return NextResponse.json(\n        {\n          message: &quot;An error occurred while deleting airline&quot;,\n        },\n        { status: 500 }\n      );\n    }\n  }\n}\n<\/code><\/pre>\n\n\n\n<h4 id=\"h-list-airline\" class=\"wp-block-heading\">List Airline<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">This endpoint retrieves the list of airlines in the database. The API has options to specify the page size for the results and country from which to fetch the airport documents.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Navigate to the <code>GET<\/code> method in the <code>app\/api\/v1\/airline\/list\/route.ts<\/code> file. This endpoint is different from the others we have seen before because it makes the SQL++ query rather than a key-value operation. This usually means more overhead because the query engine is involved. For this query, we are using the predefined indices in the <code>travel-sample<\/code> bucket. We can create an additional <a href=\"https:\/\/docs.couchbase.com\/server\/current\/learn\/services-and-indexes\/indexes\/indexing-and-query-perf.html\">index<\/a> specific for this query to make it perform better.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">First, we need to get the values from the query string for country, limit, and Offset that we will use in our query. These are pulled in by the <a href=\"https:\/\/nextjs.org\/docs\/app\/api-reference\/functions\/use-search-params\">query parameters<\/a> in Next.js API routes.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This endpoint has two queries depending on the value for the country parameter. If a country name is specified, we retrieve the airport documents for that specific country. If it is not specified, we retrieve the list of airlines across all countries. The queries are slightly different for these two scenarios.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We build our SQL++ query using the <a href=\"https:\/\/docs.couchbase.com\/nodejs-sdk\/current\/howtos\/n1ql-queries-with-sdk.html#queries-placeholders\">parameters<\/a>\nspecified by <code>$<\/code> symbol for both these scenarios. The difference between the two queries is the presence of the <code>country<\/code> parameter in the query. Normally for the queries with pagination, it is advised to order the results to maintain the order of results across multiple queries.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Next, we pass that <code>query<\/code> to the CouchbaseClient class <code>query<\/code> method. We save the results in a list, <code>airlines<\/code>.<\/p>\n\n\n\n<pre class=\"wp-block-code language-ts\"><code>export async function GET(req: NextRequest) {\n  try {\n    const { scope } = await getDatabase();\n    const country = req.nextUrl.searchParams.get(&quot;country&quot;) ?? &quot;&quot;;\n    const limit = req.nextUrl.searchParams.get(&quot;limit&quot;) ?? 10;\n    const offset = req.nextUrl.searchParams.get(&quot;offset&quot;) ?? 0;\n\n    let query: string;\n    type QueryOptions = {\n      parameters: {\n        COUNTRY?: string;\n        LIMIT: number;\n        OFFSET: number;\n      };\n    };\n\n    let options: QueryOptions;\n\n    if (country === &quot;&quot;) {\n      query = `\n        SELECT air.callsign,\n               air.country,\n               air.iata,\n               air.icao,\n               air.id,\n               air.name,\n               air.type\n        FROM airline AS air\n        LIMIT $LIMIT OFFSET $OFFSET\n      `;\n      options = {\n        parameters: {\n          LIMIT: Number(limit),\n          OFFSET: Number(offset),\n        },\n      };\n    } else {\n      query = `\n        SELECT air.callsign,\n               air.country,\n               air.iata,\n               air.icao,\n               air.id,\n               air.name,\n               air.type\n        FROM airline AS air\n        WHERE air.country = $COUNTRY\n        LIMIT $LIMIT OFFSET $OFFSET\n      `;\n      options = {\n        parameters: {\n          COUNTRY: country,\n          LIMIT: Number(limit),\n          OFFSET: Number(offset),\n        },\n      };\n    }\n\n    const result: QueryResult = await scope.query(query, options);\n    const airlines: TAirline[] = result.rows;\n\n    return NextResponse.json(airlines, { status: 200 });\n  } catch (error) {\n    return NextResponse.json(\n      {\n        message: &quot;An error occurred while fetching airlines&quot;,\n      },\n      { status: 500 }\n    );\n  }\n}\n<\/code><\/pre>\n\n\n\n<h4 id=\"h-direct-connections\" class=\"wp-block-heading\">Direct Connections<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">This endpoint fetches the airports that can be reached directly from the specified source airport code. This also uses a SQL++ query to fetch the results simlar to the List Airport endpoint.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Let us look at the query used here:<\/p>\n\n\n\n<pre class=\"wp-block-code language-sql\"><code>SELECT DISTINCT route.destinationairport\nFROM airport AS airport\nJOIN route AS route ON route.sourceairport = airport.faa\nWHERE airport.faa = $destinationAirportCode AND route.stops = 0\nLIMIT $LIMIT OFFSET $OFFSET\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">We are fetching the direct connections by joining the airport collection with the route collection and filtering based on the source airport specified by the user and by routes with no stops.<\/p>\n\n\n\n<h4 id=\"h-running-tests\" class=\"wp-block-heading\">Running Tests<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">We have defined integration tests using <a href=\"https:\/\/vitejs.dev\/\">Vite<\/a> for all the API endpoints. The integration tests use the same database configuration as the application. For the tests, we perform the operation using the API and confirm the results by checking the documents in the database. For example, to check the creation of the document by the API, we would call the API to create the document and then read the same document directly from the database using the appropriate client and compare them. After the tests, the documents are cleaned up.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The tests including the fixtures and helpers for the tests are configured in the <code>tests<\/code> folder.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To run the tests, use the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code language-sh\"><code>npm install -g vitest\nvitest app\/api\/v1\/airline\/[airlineId]\/route.test.ts\n<\/code><\/pre>\n\n\n\n<h3 id=\"h-appendix\" class=\"wp-block-heading\">Appendix<\/h3>\n\n\n\n<h4 id=\"h-extending-api-by-adding-new-entity\" class=\"wp-block-heading\">Extending API by Adding New Entity<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">If you would like to add another entity to the APIs, these are the steps to follow:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Create the new entity (collection) in the Couchbase bucket. You can create the collection using the <a href=\"https:\/\/docs.couchbase.com\/nodejs-sdk\/current\/howtos\/provisioning-cluster-resources.html#collection-management\">SDK<\/a> or via the <a href=\"https:\/\/docs.couchbase.com\/cloud\/n1ql\/n1ql-language-reference\/createcollection.html\">Couchbase Server interface<\/a>.<\/li>\n\n\n<li>Create the new entity model in the <code>models<\/code> folder similar to the existing models like <code>Airline.ts<\/code>.<\/li>\n\n\n<li>Create the new API routes in the <code>api\/v1<\/code> folder similar to the existing routes like <code>airline<\/code>.<\/li>\n\n<\/ul>\n\n\n\n<h4 id=\"h-running-self-managed-couchbase-cluster\" class=\"wp-block-heading\">Running Self Managed Couchbase Cluster<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">If you are running this quickstart with a self managed Couchbase cluster, you need to <a href=\"https:\/\/docs.couchbase.com\/server\/current\/manage\/manage-settings\/install-sample-buckets.html\">load<\/a> the travel-sample data bucket in your cluster and generate the credentials for the bucket.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Follow <a href=\"\/tutorial-couchbase-installation-options\">Couchbase Installation Options<\/a> for installing the latest Couchbase Database Server Instance.<\/li>\n\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">You need to update the connection string and the credentials in the <code>dev.env<\/code> file in the source folder.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">Note: Couchbase Server must be installed and running prior to running the Nextjs app.<\/p>\n<\/blockquote>\n\n\n\n<h4 id=\"h-swagger-documentation\" class=\"wp-block-heading\">Swagger Documentation<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Swagger documentation provides a clear view of the API including endpoints, HTTP methods, request parameters, and response objects.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Click on an individual endpoint to expand it and see detailed information. This includes the endpoint&#8217;s description, possible response status codes, and the request parameters it accepts.<\/p>\n\n\n\n<h5 id=\"h-trying-out-the-api\" class=\"wp-block-heading\">Trying Out the API<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\">You can try out an API by clicking on the &#8220;Try it out&#8221; button next to the endpoints.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\n<p>Parameters: If an endpoint requires parameters, Swagger UI provides input boxes for you to fill in. This could include path parameters, query strings, headers, or the body of a POST\/PUT request.<\/p>\n<\/li>\n\n\n<li>\n<p>Execution: Once you&#8217;ve inputted all the necessary parameters, you can click the &#8220;Execute&#8221; button to make a live API call. Swagger UI will send the request to the API and display the response directly in the documentation. This includes the response code, response headers, and response body.<\/p>\n<\/li>\n\n<\/ul>\n\n\n\n<h5 id=\"h-models\" class=\"wp-block-heading\">Models<\/h5>\n\n\n\n<p class=\"wp-block-paragraph\">Swagger documents the structure of request and response bodies using models. These models define the expected data structure using JSON schema and are extremely helpful in understanding what data to send and expect.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial, you will learn how to connect to a Couchbase Capella cluster to create, read, update, and delete documents and how to write simple parametrized SQL++ queries. Prerequisites To run this prebuilt project, you will need: Note that this tutorial is designed to work with the latest Node.js SDK (4.x) for Couchbase. It [&hellip;]<\/p>\n","protected":false},"author":0,"featured_media":0,"menu_order":0,"template":"","meta":{"_acf_changed":false,"inline_featured_image":false,"_acf":"","footnotes":""},"tutorial-languages":[653],"tutorial-tags":[664],"tutorial-technologies":[572,548,549],"tutorial-types":[550],"class_list":["post-10369","tutorials","type-tutorials","status-publish","hentry","tutorial-languages-nodejs","tutorial-tags-next-js","tutorial-technologies-index","tutorial-technologies-kv","tutorial-technologies-query","tutorial-types-quickstart"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v28.8 (Yoast SEO v28.9) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Using Next.js with Couchbase NodeJS SDK - Couchbase<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.couchbase.com\/it\/developers\/tutorials\/quickstart-nextjs-capella\/\" \/>\n<meta property=\"og:locale\" content=\"it_IT\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Using Next.js with Couchbase NodeJS SDK\" \/>\n<meta property=\"og:description\" content=\"In this tutorial, you will learn how to connect to a Couchbase Capella cluster to create, read, update, and delete documents and how to write simple parametrized SQL++ queries. Prerequisites To run this prebuilt project, you will need: Note that this tutorial is designed to work with the latest Node.js SDK (4.x) for Couchbase. It [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/it\/developers\/tutorials\/quickstart-nextjs-capella\/\" \/>\n<meta property=\"og:site_name\" content=\"Couchbase\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/Couchbase\/\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.couchbase.com\/wp-content\/uploads\/2026\/10\/Cloud-2.png\" \/>\n\t<meta property=\"og:image:width\" content=\"2548\" \/>\n\t<meta property=\"og:image:height\" content=\"1171\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@couchbase\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"15 minuti\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/it\\\/developers\\\/tutorials\\\/quickstart-nextjs-capella\\\/\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/it\\\/developers\\\/tutorials\\\/quickstart-nextjs-capella\\\/\",\"name\":\"Using Next.js with Couchbase NodeJS SDK - Couchbase\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/it\\\/#website\"},\"datePublished\":\"2024-05-10T08:15:26+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/it\\\/developers\\\/tutorials\\\/quickstart-nextjs-capella\\\/#breadcrumb\"},\"inLanguage\":\"it-IT\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.couchbase.com\\\/it\\\/developers\\\/tutorials\\\/quickstart-nextjs-capella\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/it\\\/developers\\\/tutorials\\\/quickstart-nextjs-capella\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.couchbase.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Using Next.js with Couchbase NodeJS SDK\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/it\\\/#website\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/it\\\/\",\"name\":\"Couchbase\",\"description\":\"The Operational Data Platform for AI\u2122\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/it\\\/#organization\"},\"alternateName\":\"Couchbase, Inc.\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.couchbase.com\\\/it\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"it-IT\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/it\\\/#organization\",\"name\":\"Couchbase\",\"alternateName\":\"Couchbase, Inc.\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/it\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"it-IT\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/it\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/Couchbase_Logo_Couchbase_Token_Red-1.png\",\"contentUrl\":\"https:\\\/\\\/www.couchbase.com\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/Couchbase_Logo_Couchbase_Token_Red-1.png\",\"width\":1129,\"height\":1129,\"caption\":\"Couchbase\"},\"image\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/it\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/Couchbase\\\/\",\"https:\\\/\\\/x.com\\\/couchbase\",\"https:\\\/\\\/www.youtube.com\\\/c\\\/CouchbaseServer\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/couchbase\\\/\",\"https:\\\/\\\/github.com\\\/couchbase\\\/\",\"https:\\\/\\\/en.wikipedia.org\\\/wiki\\\/Couchbase,_Inc.\"],\"description\":\"Couchbase is a database software company headquartered in San Jose, California, providing an operational data platform for AI used by hundreds of global enterprises.\",\"legalName\":\"Couchbase, Inc.\",\"foundingDate\":\"2011-01-01\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Using Next.js with Couchbase NodeJS SDK - Couchbase","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.couchbase.com\/it\/developers\/tutorials\/quickstart-nextjs-capella\/","og_locale":"it_IT","og_type":"article","og_title":"Using Next.js with Couchbase NodeJS SDK","og_description":"In this tutorial, you will learn how to connect to a Couchbase Capella cluster to create, read, update, and delete documents and how to write simple parametrized SQL++ queries. Prerequisites To run this prebuilt project, you will need: Note that this tutorial is designed to work with the latest Node.js SDK (4.x) for Couchbase. It [&hellip;]","og_url":"https:\/\/www.couchbase.com\/it\/developers\/tutorials\/quickstart-nextjs-capella\/","og_site_name":"Couchbase","article_publisher":"https:\/\/www.facebook.com\/Couchbase\/","og_image":[{"width":2548,"height":1171,"url":"https:\/\/www.couchbase.com\/wp-content\/uploads\/2026\/10\/Cloud-2.png","type":"image\/png"}],"twitter_card":"summary_large_image","twitter_site":"@couchbase","twitter_misc":{"Est. reading time":"15 minuti"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/it\/developers\/tutorials\/quickstart-nextjs-capella\/","url":"https:\/\/www.couchbase.com\/it\/developers\/tutorials\/quickstart-nextjs-capella\/","name":"Using Next.js with Couchbase NodeJS SDK - Couchbase","isPartOf":{"@id":"https:\/\/www.couchbase.com\/it\/#website"},"datePublished":"2024-05-10T08:15:26+00:00","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/it\/developers\/tutorials\/quickstart-nextjs-capella\/#breadcrumb"},"inLanguage":"it-IT","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/it\/developers\/tutorials\/quickstart-nextjs-capella\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.couchbase.com\/it\/developers\/tutorials\/quickstart-nextjs-capella\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/"},{"@type":"ListItem","position":2,"name":"Using Next.js with Couchbase NodeJS SDK"}]},{"@type":"WebSite","@id":"https:\/\/www.couchbase.com\/it\/#website","url":"https:\/\/www.couchbase.com\/it\/","name":"Couchbase","description":"The Operational Data Platform for AI\u2122","publisher":{"@id":"https:\/\/www.couchbase.com\/it\/#organization"},"alternateName":"Couchbase, Inc.","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.couchbase.com\/it\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"it-IT"},{"@type":"Organization","@id":"https:\/\/www.couchbase.com\/it\/#organization","name":"Couchbase","alternateName":"Couchbase, Inc.","url":"https:\/\/www.couchbase.com\/it\/","logo":{"@type":"ImageObject","inLanguage":"it-IT","@id":"https:\/\/www.couchbase.com\/it\/#\/schema\/logo\/image\/","url":"https:\/\/www.couchbase.com\/wp-content\/uploads\/2026\/11\/Couchbase_Logo_Couchbase_Token_Red-1.png","contentUrl":"https:\/\/www.couchbase.com\/wp-content\/uploads\/2026\/11\/Couchbase_Logo_Couchbase_Token_Red-1.png","width":1129,"height":1129,"caption":"Couchbase"},"image":{"@id":"https:\/\/www.couchbase.com\/it\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/Couchbase\/","https:\/\/x.com\/couchbase","https:\/\/www.youtube.com\/c\/CouchbaseServer","https:\/\/www.linkedin.com\/company\/couchbase\/","https:\/\/github.com\/couchbase\/","https:\/\/en.wikipedia.org\/wiki\/Couchbase,_Inc."],"description":"Couchbase \u00e8 una societ\u00e0 di software per database con sede a San Jose, in California, che fornisce una piattaforma operativa per i dati utilizzata da centinaia di aziende globali.","legalName":"Couchbase, Inc.","foundingDate":"2011-01-01"}]}},"acf":[],"permalink_manager":null,"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/it\/wp-json\/wp\/v2\/tutorials\/10369","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.couchbase.com\/it\/wp-json\/wp\/v2\/tutorials"}],"about":[{"href":"https:\/\/www.couchbase.com\/it\/wp-json\/wp\/v2\/types\/tutorials"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/it\/wp-json\/wp\/v2\/tutorials\/10369\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/it\/wp-json\/wp\/v2\/media?parent=10369"}],"wp:term":[{"taxonomy":"tutorial-languages","embeddable":true,"href":"https:\/\/www.couchbase.com\/it\/wp-json\/wp\/v2\/tutorial-languages?post=10369"},{"taxonomy":"tutorial-tags","embeddable":true,"href":"https:\/\/www.couchbase.com\/it\/wp-json\/wp\/v2\/tutorial-tags?post=10369"},{"taxonomy":"tutorial-technologies","embeddable":true,"href":"https:\/\/www.couchbase.com\/it\/wp-json\/wp\/v2\/tutorial-technologies?post=10369"},{"taxonomy":"tutorial-types","embeddable":true,"href":"https:\/\/www.couchbase.com\/it\/wp-json\/wp\/v2\/tutorial-types?post=10369"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}