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! !!

Recommended Posts

Web application development in Go language_Hands-on day 1
WEB application development using django-Development 1-
Web application development with Flask
WEB application development using Django [Django startup]
WEB application development using Django [Application addition]
Automatic minimum testing in web development
WEB application development using Django [Model definition]
WEB application development using Django [Initial settings]
Display matplotlib diagrams in a web application
WEB application development using Django [Request processing]
About Cloud run + Firebase development [Web application development]
WEB application development using Django [Admin screen creation]
[Day 4] Application creation
Steps to develop a web application in Python
Create a web server in Go language (net/http) (2)
Solve the problem that CSS is not reflected during web application development in Flask
Create a web server in Go language (net / http) (1)
Write Pulumi in Go
Pepper Web API cooperation explanation For those who have no experience in Pepper application development / programming
Web application using Bottle (1)
Framework development in Python
Development environment in Python
Slackbot development in Python
A story about everything from data collection to AI development and Web application release in Python (3. AI development)