Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 

servers-gonna-serve docs

A small package that wraps up serving a http.Handler via a port or socket. It catches interrupts so any defers will run properly.

package main

import (
  "hawx.me/code/serve"
  "net/http"
  "flag"
)

var (
  port   = flag.String("port", "8080", "")
  socket = flag.String("socket", "", "")
)

func main() {
  flag.Parse()

  http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
    // ...
  })

  serve.Serve(*port, *socket, http.DefaultServeMux)
}

About

serve.Serve()

Resources

License

Releases

No releases published

Packages

No packages published

Languages