
HTTP Server
net/http, handlers, ServeMux, middleware, request/response, routing, context
1What is the net/http package in Go?
What is the net/http package in Go?
Resposta
The net/http package provides functionality for creating HTTP servers and clients. It includes types like http.Server, http.Handler, http.Request, http.ResponseWriter and functions like ListenAndServe. It's Go's standard library for HTTP, used in most web applications without external dependencies.
2How to create a simple HTTP server in Go?
How to create a simple HTTP server in Go?
Resposta
The http.ListenAndServe function starts an HTTP server on a given port with a handler. It takes two parameters: the address (e.g. ':8080') and a handler (can be nil to use DefaultServeMux). It's the simplest method to start a server, it blocks until an error occurs.
3What is an http.Handler in Go?
What is an http.Handler in Go?
Resposta
An http.Handler is an interface with a single method ServeHTTP(ResponseWriter, *Request). Any type implementing this method can handle HTTP requests. It's the basic contract for creating custom handlers, middleware and routers. All Go web frameworks use this interface as foundation.
What is the difference between http.Handler and http.HandlerFunc?
What is http.ServeMux used for?
+21 perguntas de entrevista
Outros temas de entrevista Go
Go Basics
Go Data Structures
Go Interfaces
Error Handling
Goroutines Basics
Channels
Go Modules
HTTP Client
JSON Encoding
database/sql
Context Package
Testing
Concurrency Patterns
Sync Primitives
Go Web Frameworks
REST API Design
gRPC
Reflection
Memory Management
Performance Optimization
Generics
Go Design Patterns
Microservices
Security & Authentication
Docker & Containerization
Kubernetes Basics
Advanced Go
CLI Development
Domine Go para sua proxima entrevista
Acesse todas as perguntas, flashcards, testes tecnicos, exercicios de code review e simuladores de entrevista.
Comece gratis