Go Web Programming - Sau Sheong Chang

Go Web Programming

Buch | Softcover
312 Seiten
2016
Manning Publications (Verlag)
978-1-61729-256-9 (ISBN)
43,75 inkl. MwSt
As the importance of the Go language grows, the need for a great tutorial grows with it. This book fills this need. Shaun Lippy, Oracle Corporation.
  • Comprehensive and detailed tour of Go's powerful features
  • Step-by step guide for end-to-end Web application development
  • Tip and tricks for avoiding common pitfalls
  • Written for Web developers with a working knowledge of the Go language.

Google built the Go language from the ground up to simplify the challenges of modern application development.

Go is ideal for writing server-side components that route and process data and manage the event-driven nature of modern web applications. Go's instantly-familiar syntax and structure make it easy to build application components from scratch, and a full-featured standard library, along with a growing ecosystem of libraries and frameworks provide an abundance of pre-built functionality so developers can be super-productive quickly.

Go Web Programming shows how to build web applications in Go using modern design principles. It provides numerous examples that introduce core concepts like processing requests and sending responses, template engines, and data persistence.

It also dives into more advanced topics, such as concurrency, web application testing, and deployment both to barebones servers and PaaS providers.

About the Technology
The Go language handles the demands of scalable, high-performance web applications by providing clean and fast compiled code, garbage collection, a simple concurrency model, and a fantastic standard library. It’s perfect for writing microservices or building scalable, maintainable systems.

Sau Sheong Chang is a Director of Consumer Engineering at PayPal. He is active in the Ruby and Go developer communities, and has written books, contributed to open source projects and spoken at meetups and conferences.

1. Go and web applications
1.1. Using Go for web apps
1.1.1. Scalable web apps and Go
1.1.2. Modular web apps and Go
1.1.3. Maintainable web apps and Go
1.1.4. High performing web apps and Go
1.2. How web apps work
1.3. A quick introduction to HTTP
1.4. The coming of web apps
1.5. HTTP request
1.5.1. Request methods
1.5.2. Safe request methods
1.5.3. Idempotent request methods
1.5.4. Browser support for request methods
1.5.5. Request headers
1.6. HTTP response
1.6.1. Response status code
1.6.2. Response headers
1.7. URI
1.8. Introducing HTTP/2
1.9. Parts of a web app
1.9.1. Handler
1.9.2. Template engine
1.10. Hello Go
1.11. Summary
2. Go ChitChat
2.1. Let's ChitChat
2.2. Application design
2.3. Data model
2.4. Receiving and processing requests
2.4.1. The multiplexer
2.4.2. Serving static files
2.4.3. Creating the handler function
2.4.4. Access control using cookies
2.5. Generating HTML responses with templates
2.5.1. Tidying up
2.6. Installing PostgreSQL
2.6.1. Linux/FreeBSD
2.6.2. Mac OS X
2.6.3. Windows
2.7. Interfacing with the database
2.8. Starting the server
2.9. Wrapping up
2.10. Summary
Part 2: Basic Web Applications
3. Handling requests
3.1. The Go net/http library
3.2. Serving Go
3.2.1. The Go web server
3.2.2. Serving through HTTPS
3.3. Handlers and handler functions
3.3.1. Handling requests
3.3.2. More handlers
3.3.3. Handler functions
3.3.4. Chaining handlers and handler functions
3.3.5. ServeMux and DefaultServeMux
3.3.6. Other multiplexers
3.4. Using HTTP/2
3.5. Summary
4. Processing requests
4.1. Requests and responses
4.1.1. Request
4.1.2. Request URL
4.1.3. Request header
4.1.4. Request body
4.2. HTML forms and Go
4.2.1. Form
4.2.2. PostForm
4.2.3. MultipartForm
4.2.4. Files
4.2.5. Processing POST requests with JSON body
4.3. ResponseWriter
4.3.1. Writing to the ResponseWriter
4.4. Cookies
4.4.1. Cookies with Go
4.4.2. Sending cookies to the browser
4.4.3. Getting cookies from the browser
4.4.4. Using cookies for flash messages
4.5. Summary
5. Displaying content
5.1. Templates and template engines
5.2. The Go template engine
5.2.1. Parsing templates
5.2.2. Executing templates
5.3. Actions
5.3.1. Conditional actions
5.3.2. Iterator actions
5.3.3. Set actions
5.3.4. Include actions
5.4. Arguments, variables, and pipelines
5.5. Functions
5.6. Context awareness
5.6.1. Defending against XSS attacks
5.6.2. Unescaping HTML
5.7. Nesting templates
5.8. Using the block action to define default templates
5.9. Summary
6. Storing data
6.1. In-memory storage
6.2. File storage
6.2.1. Reading and writing CSV files
6.2.2. The gob package
6.3. Go and SQL
6.3.1. Setting up the database
6.3.2. Connecting to the database
6.3.3. Creating a post
6.3.4. Retrieving a post
6.3.5. Updating a post
6.3.6. Deleting a post
6.3.7. Getting all posts
6.4. Go and SQL relationships
6.4.1. Setting up the databases
6.4.2. One-to-many relationship
6.5. Go relational mappers
6.5.1. Sqlx
6.5.2. Gorm
6.6. Summary
Part 3: Being Real
7. Go web services
7.1. Introducing web services
7.2. Introducing SOAP-based web services
7.3. Introducing REST-based web services
7.3.1. Convert action to a resource
7.3.2. Make the action a property of the resource
7.4. Parsing and creating XML with Go
7.4.1. Parsing XML
7.4.2. Creating XML
7.5. Parsing and creating JSON with Go
7.5.1. Parsing JSON
7.5.2. Creating JSON
7.6. Creating Go web services
7.7. Summary
8. Testing your application
8.1. Go and testing
8.2. Unit testing with Go
8.2.1. Skipping test cases
8.2.2. Running tests in parallel
8.2.3. Benchmarking
8.3. HTTP testing with Go
8.4. Test doubles and dependency injection
8.4.1. Dependency injection with Go
8.5. Third-party Go testing libraries
8.5.1. Introducing the gocheck testing package
8.5.2. Introducing the Ginkgo testing framework
8.6. Summary
9. Leveraging Go concurrency
9.1. Concurrency isn't parallelism
9.2. Goroutines
9.2.1. Using goroutines
9.2.2. Goroutines and performance
9.2.3. Waiting for goroutines
9.3. Channels
9.3.1. Synchronization with channels
9.3.2. Message passing with channels
9.3.3. Buffered channels
9.3.4. Selecting channels
9.4. Concurrency for web applications
9.4.1. Creating the photo mosaic
9.4.2. The photo mosaic web application
9.4.3. Concurrent photo mosaic web application
9.5. Summary
10. Deploying Go
10.1. Deploying to servers
10.2. Deploying to Heroku
10.3. Deploying to Google App Engine
10.4. Deploying to Docker
10.4.1. What is Docker?
10.4.2. Installing Docker
10.4.3. Docker concepts and components
10.4.4. Dockerizing a Go web application
10.4.5. Pushing your Docker container to the internet
10.5. Comparison of deployment methods
10.6. Summary
Appendixes
Appendix A: Installing and setting up Go
A.1. Installing Go
A.1.1. Linux/FreeBSD
A.1.2. Windows
A.1.3. Mac OS X
A.2. Setting up Go

Erscheint lt. Verlag 4.8.2016
Verlagsort New York
Sprache englisch
Maße 185 x 234 mm
Gewicht 1000 g
Einbandart kartoniert
Themenwelt Informatik Web / Internet Web Design / Usability
Schlagworte Go (Programiersprache) • Webentwicklung • Web Programmierung
ISBN-10 1-61729-256-7 / 1617292567
ISBN-13 978-1-61729-256-9 / 9781617292569
Zustand Neuware
Haben Sie eine Frage zum Produkt?
Mehr entdecken
aus dem Bereich