How Do I Write And Deploy Simple Web Apps With Go?
Minimum price
Suggested price

How Do I Write And Deploy Simple Web Apps With Go?

About the Book

The aim of the book is to get Go newbies started with developing and deploying web applications written using the Go programming language. By the time you finish reading the book, you would have developed and deployed many fun Go web apps on Heroku and Google App Engine.

You will learn to:

  • create static sites with Go
  • consume JSON apis with a Go web app
  • interact with Google apis with a Go web app
  • use MongoDB with Go on the web and 
  • use Martini the Go web framework.

About the Author

Satish Talim
Satish Talim

Satish Talim is the founder of RubyLearning, that helps Ruby programmers become awesome! He has more than 40 years of industrial experience and is a board member at Josh Software Pvt. Ltd. and Maybole Technologies Pvt. Ltd.

He is a trustee on the Emerging Technology Trust that organizes conferences in India like GopherConIndia and RubyConfIndia.

He has published many books on Amazon and was awarded Ruby's Top Teacher in 2008 and the winner of the Shorty Award in Education in 2009.

Follow @indianguru on Twitter or email him at

About the Contributors

Victor Goff
Victor Goff

Mentoring at since 2008.

Sanat Gersappa
Sanat Gersappa


Occupation: Web Guy, Early Adopter, Alpha Geek, Options Trader. Skills: Specialist in Web technologies. Good at ASP.NET, Node.js, Go, Client-side Javascript frameworks.

Table of Contents

  • Preface
    • Who is the eBook for?
    • Acknowledgements
    • How to Use This eBook
    • Using Code Examples
    • Getting the Code
    • How to Contact Me
    • Thanks
  • 1. Go Code Organization
    • 1.1 Workspaces
    • 1.2 The GOPATH environment variable
    • 1.3 Package paths
  • 2. A basic Go web app
  • 3. Static Sites with Go
  • 4. Using a Web Service - JSON with Go
    • 4.1 service
  • 5. Package template
    • 5.1 struct
    • 5.2 array
    • 5.3 slice
    • 5.4 text/template
      • 5.4.1 Variables
    • 5.5 html/template
      • 5.5.1 Modify dosasite.go to use templates
    • 5.6 Handling Forms
    • 5.7 Web app stringupper
  • 6. Using Google Geocoding and Street View Image APIs
    • 6.1 APIs to be used
    • 6.2 Create folders
    • 6.3 File goview.css
    • 6.4 Program geoweb.go
      • 6.4.1 User Form
      • 6.4.2 QueryEscape
      • 6.4.3 defer
      • 6.4.4 Using Google Geocoding and Street View Image APIs
        • Required parameters
  • 7. Go and MongoDB on MongoLab
    • 7.1 What’s NoSQL?
    • 7.2 What’s MongoDB?
      • 7.2.1 MongoDB Core Concepts
    • 7.3 MongoLab - The Fully-managed MongoDB-as-a-Service
      • 7.3.1 Sign Up
      • 7.3.2 Create a database subscription
      • 7.3.3 Database User
      • 7.3.4 mgo
      • 7.3.5 JSON Recap
      • 7.3.6 package mgo
        • Function Close
        • Function SetSafe
        • Function Safe
        • Function DB
        • Function C
        • Function Insert
        • Function Find
        • Function One
      • 7.3.7 package bson
        • type M
      • 7.3.8 Program mongohqconnect.go
      • 7.3.9 Web app trails.go
  • 8. Go and Gmail
  • 9. A Fun, Weather Forecast Go Web App
    • 9.1 Register for an account at Forecast for Developers
      • 9.1.1 Study the API documentation
        • The Forecast Call
        • Data Points
      • 9.1.2 Our app weather.go
        • Concurrent Queries
        • Run the program
  • 10. Deploying Go Web Apps to Heroku
    • 10.1 Cloud Computing Service Levels
      • 10.1.1 SaaS
      • 10.1.2 IaaS
      • 10.1.3 PaaS
    • 10.2 Create an account on Heroku
    • 10.3 Install the Heroku Toolbelt
    • 10.4 Prepare a web app
    • 10.5 Use Git
    • 10.6 Create a Procfile
    • 10.7 Install Godep
    • 10.8 Declare app dependencies
    • 10.9 Using godep with our project
    • 10.10 Add these new files to git
    • 10.11 Deploy the app
    • 10.12 Program gomongohq.go
  • 11. Deploying Go Web Apps to Google App Engine
    • 11.1 Google App Engine
      • 11.1.1 Sandbox
      • 11.1.2 Services
      • 11.1.3 The Administration Console
      • 11.1.4 Applications (web and non-web)
      • 11.1.5 DataStore
    • 11.2 The Go runtime environment
    • 11.3 Download and Install the App Engine SDK
    • 11.4 Let us build a small app (mytext.go) locally
      • 11.4.1 Program mytext.go
      • 11.4.2 Create the Configuration File
      • 11.4.3 Test the App
      • 11.4.4 Iterative Development
    • 11.5 Uploading Your App to Google’s App Engine
      • 11.5.1 Registering the App
      • 11.5.2 Upload and Access the app
    • 11.6 Web app upperstring.go
    • 11.7 Web app EXIF Map - blobstrex.go
      • 11.7.1 Program blobstrex.go
        • File app.yaml
      • 11.7.2 Blobstore Go API
        • The appengine package
          • NewContext
        • The blobstore package
          • UploadUrl
      • 11.7.3 Uploading a photo (blob)
        • Create an upload URL
        • Create an upload form
      • 11.7.4 Using goexif
      • 11.7.5 Google Static Maps API
    • 11.8 Modifying geoweb.go for Google App Engine
    • 11.9 Check out
  • 12. Web Toolkits and App Frameworks for Go
    • 12.1 Martini
    • 12.2 Installation of Martini
      • 12.2.1 Check whether Martini works
      • 12.2.2 Classic Martini
      • 12.2.3 Handlers
        • Return Values
      • 12.2.4 Routing
      • 12.2.5 Serving Static Files
      • 12.2.6 Middleware Handlers
    • 12.3 Upload a Martini app to Google App Engine
    • 12.4 What next?

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

80% Royalties. Earn $16 on a $20 book.

We pay 80% royalties. That's not a typo: you earn $16 on a $20 sale. If we sell 5000 non-refunded copies of your book or course for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earnedover $13 millionwriting, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub