Go Web Programming
quick get start
Routing Distribution
-
The underlying mechanism of HTTP request processing -
Low level implementation of route mapping and request distribution and custom router -
Routing definition and request distribution based on gorilla/mux package: basic use -
Route definition and request distribution based on gorilla/mux package: advanced use -
Implementation of routing definition and request distribution based on gorilla/mux package: routing middleware -
Implement route definition and request distribution based on gorilla/mux package: handle static resource response -
Routing definition and request distribution based on gorilla/mux package: service SPA application -
Implement route definition and request distribution based on gorilla/mux package: handle cross domain requests based on CORS -
Route definition and request distribution based on gorilla/mux package: health check and interface test -
Split the Go routing processor code following the Larravel framework
Request processing
-
Read the HTTP request message through Request -
Get user request data (I): query string, form request and JSON request -
Get user request data (Part 2): File upload processing -
Set HTTP response through ResponseWriter interface object -
Set, read, and delete HTTP cookies in the Go language -
Manage session in Go language based on gorilla/sessions package
View Template
Tips: At present, the mainstream of Web development is to separate the front end from the back end. The front end is written through the JavaScript framework, and the back end provides data services through the API interface. So you can understand the view template and focus on the API interface development.
-
Definition, parsing and execution of template engine -
Introduction of control structure and template through instructions -
Parameters, Pipes and Function Calls -
Context awareness and preventing XSS attacks -
Template layout and inheritance
Note: Some code examples of view template are quoted from 《Go Web Programming》 This book.
error handling
data storage
-
Implementation of data addition, deletion, modification and query based on memory storage -
File storage (I): serialize text data through JSON format -
File storage (II): read and write text data through CSV file -
File storage (III): access binary data through Gob format
Database operation
-
Implementation of connection establishment and addition, deletion, modification and query -
Association relation and association query between data tables -
Getting Started with GORM
Concurrent programming
-
Go Concurrent Programming Basics -
Common Concurrency Mode Implementation (I): Job Program for Scheduling Background Processing Tasks -
Common Concurrency Mode Implementation (2): Shared resource pool through buffer channel -
Common Concurrency Mode Implementation (3): Create a coroutine pool through a bufferless channel -
Image mosaic application based on Go collaboration (I): synchronous version -
Image Mosaic Application Based on Go Collaboration (Part 2): Concurrent Version
Security technology
-
XSS -
CSRF protection -
Encryption/decryption -
Password storage (hash) -
Implementation of user authentication function -
HTTPS
Web Services
-
SOAP+XML -
REST+JSON -
RPC
Test series
-
unit testing -
HTTP test -
Benchmarking -
Dependency Injection and Simulation -
Third party test package
Entry project: online forum
-
Build online forum project (I): overall design and data model -
Build online forum project (II): model class interacts with MySQL database -
Build online forum project (III): visit the forum home page -
Build online forum project (IV): user authentication implementation (based on cookie+session) -
Build online forum project (V): create groups and topics -
Building an online forum project (VI): logs and error handling -
Build online forum project (7): obtain global configuration through a single example -
Build online forum project (VIII): message, view, date and time localization -
Build online forum project (9): deploy Go Web application -
Supplement: Read configuration and realize hot loading through Viper
Statement: This project is based on Go Web Programming In a book chitchat For the secondary development, the database is adjusted to MySQL, the router is adjusted to gorilla/linux, the overall directory structure is adjusted, and the configuration file singleton mode acquisition, localized programming and application deployment process are added based on the original project. The complete project code has been submitted to Github warehouse: https://github.com/nonfu/chitchat 。
Application deployment
-
Deploy to server -
cloud computing -
Deploy to Docker
Development framework
Gin
Beego
-
Beego official website -
BEEGO Framework Introduction: BEEGO! A Golang Web Framework -
BEEGO Framework Introduction: Quickly create Web projects through Bee, a scaffolding tool provided by BEEGO
Practical project
Public account&community
Subscription Service