Web Servers Flashcards
How does Go handle many requests at the same time?
Go spawns a new goroutine for each request
What is an http.ServeMux?
It is a request multiplexer, which essentially a router for HTTP requests.
What is a fileserver?
A web server that serves static files from the host machine.
e.g.
- HTML
- CSS
- JS
- Images
What is http.Server?
A struct that describes a server configuration
What is a readiness endpoint?
Readiness endpoints are commonly used by external systems to check if our server is ready to receive traffic
What can make the code of handlers more DRY?
Middleware
What other libraries apart from Go standard are used for routing?
- Gorilla Mux
- Chi
Which type of HTTP request is more common to send JSON data in the requested body?
POST request
What is JSON Marshalling?
Marshaling a JSON file refers to the process of converting data structures or object instances into a JSON format
What are the JSON keys in the following struct?
type parameters struct {
Name string json:"name"
Age int json:"age"
School struct {
Name string json:"name"
Location string json:"location"
} json:"school"
}
name, age, school, school.name, school.location
What are the JSON keys in the following struct?
type parameters struct {
name string json:"name"
Age int json:"age"
}
age
What are the JSON keys in the following struct?
type parameters struct {
Name string
Age int
}