http.Handler Interface

A Handler responds to an HTTP request. ServeHTTP should write reply headers and data to the ResponseWriter and then return. Returning signals that the request is finished; it is not valid to use the ResponseWriter or read from the Request.Body after or concurrently with the completion of the ServeHTTP call. Read more…

http.ListenAndServer

ListenAndServe starts an HTTP server. with a given address and handler. The handler is usually nil, which means to use DefaultServeMux. Handle and HandleFunc add handlers to DefaultServeMux: log.Fatal(http.ListenAndServe(“:8080”, nil)) func ListenAndServe func ListenAndServe(addr string, handler Handler) error ListenAndServe listens on the TCP network address addr and then calls Serve with Read more…

Creating Docker Volumes

the volume create command of the docker docker volume create testVolume This command creates a data volume name testVolume that can be used by a specific container or shared among a cluster of containers. docker volume inspect testVolume The resultant data shows that our testVolume is mounted at the location Read more…

Dockerfile Best Practices

Best practices for writing Dockerfiles Each instruction creates one layer: FROM creates a layer from the alpine 3.12 Docker image. COPY adds files from your Docker client’s current directory. RUN builds your application with make. CMD specifies what command to run within the container.

Go: Libraries

 In libraries, the package need not be called main nor do you need the main function. As libraries aren’t applications, you cannot build a binary file with them and you need the main package that is going to use them.