Part 2: Learn To Build & Deploy Simple Go Web Apps

In part one of this tutorial, we installed the Google App Engine SDK and then built and ran a simple web app locally.

Now, we shall deploy our simple web app to the Google App Engine.

Uploading Your App to Google’s App Engine

Registering the App

You will now need to have a Google account. If you do not have a Google account, you can create a Google account with an email address and password.

You create and manage App Engine web applications from the App Engine Administration Console. Sign in to App Engine using your Google account.

To create a new application, click the “Create Application” button.

Verify your account

As seen in the image above, you will be asked to verify your account. Enter your mobile details and wait for the verification code.

After receiving it, enter your verification code as shown below:

Enter Verification code

A “Create an Application” screen comes up as shown below:

Create an application

Here you need to enter an unique “Application Identifier” (a name unique to this application). We have entered wcomemsg.

Also enter your “Application Title”.

Note: Once you register an Application Identifier, you can delete it, but you can’t re-register that same application ID after it has been deleted.

We have elected to use the free appspot.com domain name. With that the full URL for the application will be http://your_app_id.appspot.com/.

Accept the terms and click on the “Create Application” button. If successful, you should see a screen like this:

Application registered

Edit the app.yaml file, then change the value of the application: setting from welcome to your registered application ID.

Upload and Access the app

Before you upload your finished application to Google App Engine, it is advisable that you create an application-specific password.

Once that has been registered, you can upload your app. From the folder:
$GOPATH/src/github.com/SatishTalim folder, type:

goapp deploy welcome/

You will be asked to enter your Google email id and the password that you have just created.

If you see compilation errors, fix the source and re-run goapp deploy; it won’t launch (or update) your app until compilation is successful.

Access the app

You can now see your application running on App Engine. We have our message app running, that you can access and check out.

Congrats you have just successfully launched your first Go web app for the world to see!!

App Engine determines that an incoming request is intended for your application using the domain name of the request. A request whose domain name is http://your_app_id.appspot.com is routed to the application whose ID is your_app_id. Every application gets an appspot.com domain name for free.

Requests for these URLs all go to the version of your application that you have selected as the default version in the App Engine Administration Console. Each version of your application also has its own URL, so you can deploy and test a new version before making it the default version. The version-specific URL uses the version identifier from your app’s configuration file in addition to the appspot.com domain name, in this pattern: http://version_id-dot-latest-dot-your_app_id.appspot.com. We have for example, version 2 of our app here.

In part three, you will learn about package template (namely text/template and html/template).

I hope you’ve enjoyed this post, please leave any feedback in the comments section.

You can find the other parts of the series at the following links:

4 thoughts on “Part 2: Learn To Build & Deploy Simple Go Web Apps

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.