Creating a Guestbook Application

This tutorial shows you how to implement a Go application for App Engine—a simple guestbook that lets users post messages to a public message board. It uses the Go http package to serve web pages and Go's html/template package.

The web application looks like this:

Objectives

  1. Clone the tutorial project.
  2. Walk through the code to see how to integrate your application with Google accounts, handle web forms, and store data in Google Cloud Datastore.
  3. Run, test, and deploy the project.

Costs

There are no costs associated with running this tutorial. This application does not exceed the free quota.

Before you begin

  1. Create or select a Cloud Platform project in the Cloud Platform Console and then ensure that project includes an App Engine application:

    Go to App Engine

    The Dashboard opens if an App Engine application already exists in your project. Otherwise, you are prompted to choose the region where you want your App Engine application located.

  2. Install and then initialize the Google Cloud SDK.

Cloning the project from GitHub

  1. Clone the Guestbook application repository to your local machine:

    git clone https://github.com/GoogleCloudPlatform/appengine-guestbook-go.git
    
  2. Switch to the branch with the final version of the application:

    cd appengine-guestbook-go/
    git fetch
    git checkout part4-usingdatastore
    

The cloned project contains several branches. In this tutorial we will only cover the project in the branch named part4-usingdatastore.

Building and running locally

To build and run the sample locally:

  1. From the location where you cloned the part4-usingdatastore branch of the appengine-guestbook-go project, start the local development server by running the following command:

    dev_appserver.py app.yaml
    
  2. The local development server is now running, and you can visit this URL in your web browser:

    http://localhost:8080

  3. The app serves a page that allows anonymous users to sign the guestbook.

  4. To stop the local development server, press Control+C.

Understanding the code

To walk through the application code and see how it works, continue to the next page.

Monitor your resources on the go

Get the Google Cloud Console app to help you manage your projects.

Send feedback about...

App Engine standard environment for Go