Node.js Bookshelf app

The Bookshelf app is a sample web app written in Node.js that shows how to use various Google Cloud Platform (GCP) products, including:

  • App Engine standard environment
  • Cloud Datastore
  • Cloud Storage
  • Cloud Pub/Sub

This tutorial explores the Bookshelf sample app and discusses how each feature of the app is implemented using technologies and services that GCP provides.

Screenshot of the Bookshelf app showing controls and book covers

The Bookshelf sample app stores a collection of book titles. Anyone with access to the app can modify the list. The sample app lets users:

  • View the list of books.
  • Add books to the list.
  • Remove books from the list.
  • Edit book details.
  • Upload cover images for books.

Objectives

  • Clone or download the sample app.
  • Build the app and run it on your local machine.
  • Deploy the app to App Engine.
  • Walk through the sample code.
  • Learn how the app stores structured data.
  • Learn how the app stores binary data in Cloud Storage.

Costs

This tutorial uses billable components of GCP.

This tutorial has several steps, and each step is documented on its own page. The final page of the tutorial includes instructions for cleaning up resources so you won't continue to be billed for GCP services. If you decide not to complete all the steps of the tutorial, see the cleanup instructions on the final page.

Before you begin

  1. To set up your Google Cloud Platform project, use the GCP Console:
    1. Create a GCP project, create an App Engine app, and then enable billing in that project.
      Go to App Engine

      When prompted, select the region where you want your App Engine app located, and then enable billing. After your GCP project is created, the Dashboard opens.

    2. Enable the Cloud Datastore, Cloud Pub/Sub, Cloud Storage JSON, Stackdriver Logging APIs.

      Enable the APIs

  2. Download, install, and initialize the Cloud SDK.
    Download the Cloud SDK
  3. Acquire local credentials for authenticating with GCP services.
    gcloud auth application-default login
  4. Verify that your default project is correct.
    gcloud config list
    If the project ID listed in the output isn't the project that you intended to use for this tutorial, set the project.
    gcloud config set project [YOUR_PROJECT_ID]
    where [YOUR_PROJECT_ID] is the ID of the project that you created or chose to use for this tutorial.
  5. Clone the sample repository.

    git clone https://github.com/GoogleCloudPlatform/nodejs-getting-started.git

    Alternatively, you can download the sample as a zip file and extract it.

This tutorial assumes that you are familiar with Node.js programming and that you have already prepared your environment for Node.js development.

Tutorial structure

The Bookshelf tutorial has several parts that demonstrate how the sample app uses various GCP services.

Trang này có hữu ích không? Hãy cho chúng tôi biết đánh giá của bạn:

Gửi phản hồi về...