Web application development in Go language_Hands-on day 1
While hands-on with the contents of this reference book, I have summarized the parts that are lacking in understanding.
https://www.oreilly.co.jp/books/9784873117522/
The sample program is provided on GitHub.
https://github.com/oreilly-japan/go-programming-blueprints/tree/master/chapter1/chat
Outline to create a chat application
-Create a web server that provides HTML
・ Add a function to exchange chat messages
Summary of usage packages
Package name |
Details |
net/http |
Provides HTTP client and server implementations
|
text/template |
Implemented a data-driven template to generate text output |
html/template |
Implemented a data-driven template to generate HTML output that is safe for code injection |
path/filepath |
Implemented utility routines for manipulating filename paths in a way that is compatible with operating system-defined file paths |
sync |
Provides basic synchronization primitives such as mutual exclusive locks |
func(w http.ResponseWriter, r *http.Request)
This notation is often used when processing HTTP requests.
Difference between text/template and html/template
They do the same thing, except that the html/template package is context sensitive. It has the advantages of avoiding attacks that embed malicious scripts and encoding characters that cannot be used in URLs.
What is sync.Once type ??
A type that can guarantee that a function will only be executed once.
Impressions
I felt it was a reference book for intermediate users. There are many places where understanding cannot catch up, so it is quite difficult ...
I will do my best to finish the first lap for the time being! !!