How Do I Write And Deploy Simple Web Apps With Go?
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 Contributors
Mentoring at RubyLearning.org since 2008.
Mr.
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 hosttip.info 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
- 6.4.4.1 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
- 7.3.6.1 Function Close
- 7.3.6.2 Function SetSafe
- 7.3.6.3 Function Safe
- 7.3.6.4 Function DB
- 7.3.6.5 Function C
- 7.3.6.6 Function Insert
- 7.3.6.7 Function Find
- 7.3.6.8 Function One
-
7.3.7 package bson
- 7.3.7.1 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
- 9.1.1.1 The Forecast Call
- 9.1.1.2 Data Points
-
9.1.2 Our app weather.go
- 9.1.2.1 Concurrent Queries
- 9.1.2.2 Run the program
-
9.1.1 Study the API documentation
-
9.1 Register for an account at Forecast for Developers
-
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
-
10.1 Cloud Computing Service Levels
-
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
- 11.7.1.1 File app.yaml
-
11.7.2 Blobstore Go API
-
11.7.2.1 The appengine package
- 11.7.2.1.1 NewContext
-
11.7.2.2 The blobstore package
- 11.7.2.2.1 UploadUrl
-
11.7.2.1 The appengine package
-
11.7.3 Uploading a photo (blob)
- 11.7.3.1 Create an upload URL
- 11.7.3.2 Create an upload form
- 11.7.4 Using goexif
- 11.7.5 Google Static Maps API
-
11.7.1 Program blobstrex.go
- 11.8 Modifying geoweb.go for Google App Engine
- 11.9 Check out
-
11.1 Google App Engine
-
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
- 12.2.3.1 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...
Earn $8 on a $10 Purchase, and $16 on a $20 Purchase
We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.
(Yes, some authors have already earned much more than that on Leanpub.)
In fact, authors have earnedover $14 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