Please enable JavaScript.
Coggle requires JavaScript to display documents.
Apress - Go Web Development - Coggle Diagram
Apress - Go Web Development
Chapter 1
Workspace
src: source files
pkg: package objects
bin: executable files
Package
Executable Programs
Shared Library
Command
go install (put to bin folder if executable and put to pkg if shared library)
go build (put to package folder)
go test
Name Convention
Start with uppercase: public
Start with lowercase: private
Go Mobile
Native mobile app entired written in Go
Go package and invoking from Java or Obj-C
Chapter 2
Package Alias (import mysql "lib/mysql/db")
Package Init (func init())
Blank Identifier (import _ "lib/mongodb/db")
Commnd
go get
go fmt
Slice
append
copy
Chapter 3
Type Embedding for Composition (inheritance)
Type
Concrete Type
Interrface Type (dynamic type)
Chanel
Unbuffed
Buffed
Chapter 4
Handle (receive http.Handler or ServeHTTP interface)
HandleFunc (received function with ServeHTTP interface)
Mux Gorilla for 3rd party Multiplexer (support REST)
Chapter 5
text/template
Exexcute
ExecuteTemplate
html/template
Must helper to ensure return Template object and error when parse templates
Chapter 6
Middleware
Logging HTTP request and response
Compress HTTP response
Common HTTP response headers
Create Database session object
Security and Authentication
How to write a custom middleware
Receive http.Handler
Return http.Handler
3rd Party Middleware
gihub.com/gorilla/handlers
github.com/codegangsta/negromi
Shareing Values among Middlwares
github.com/gorilla/context
Set
Get
GetOk
Chapter 7 (Authentication)
OAuth2 with Goth
JWT with jwt-go
Chapter 8 (Persistence Storage)
Chapter 9 (RESTful API)
Chapter 10 (Testing)
testing package
Test
Benchmark
Example
Skip
testing.Short()
t.Parallel() to run parallel to speed up test execution
-short flag
-parallel 2 flag
utils_test.go
utilstring_test.go
import with . notation will allow you to call exported identifiers without referring to the package name
Web Testing
httptest.ResponseRecoder
httptest.Server
Third party testing package
Ginkgo
ginkgo bootstrap
ginkgo generate users
ginkgo -v
Gomega
Chapter 11 (Building on Google Cloud)
Google App Engine (PaaS)
goapp serve
goapp deploy
app.yml
goapp serve app_id
Google Compute Engine (IaaS)
Google Container Engine (CaaS)
build constraint
// +build !appengine
// +build appengine
NoSQL
Google Cloud Bigtable
Google Cloud Datastore
SQL
Google Cloud SQL
Google Cloud Endpoint (for creating backend API)
Doc
Explorer
Generate Client Libraries