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
The UI for the application looks like this:
- Clone the tutorial project.
- Walk through the code to see how to integrate your application with Google accounts, handle web forms, and store data in Google Cloud Datastore.
- Run, test, and deploy the project.
There are no costs associated with running this tutorial. This application does not exceed the free quota.
Before you begin
- If you don't have it installed, download Python 2.7. The Go software development kit (SDK) uses modified versions of the development tools from the Python SDK.
- Download the App Engine SDK for Go.
Optionally, to simplify development and deployment, add the directory to the Go SDK to your PATH environment variable by adding the following line to your
$HOME/.bashrc, or equivalent:
Sign in to your Google account.
If you don't already have one, sign up for a new account.Select or create a Cloud Platform Console project.
- Note the Project ID, which might be different from the project name and is used in commands.
Cloning the project from GitHub
Clone the Guestbook application repository to your local machine:
git clone https://github.com/GoogleCloudPlatform/appengine-guestbook-go.git
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
Building and running locally
To build and run the sample locally:
From the project
appengine-guestbook-goin the branch
part4-usingdatastore, invoke the command:
The development web server is now running, and you can visit this URL in your browser:
The app serves a page that allows anonymous users to sign the guestbook.
Terminate the development server by pressing Control+C.
Understanding the code
To walk through the application code and see how it works, continue to the next page.