serve

package module
v0.0.0-...-eb94630 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 7, 2019 License: MIT Imports: 8 Imported by: 22

README

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)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Recover

func Recover(h http.Handler) http.Handler

func Serve

func Serve(port, socket string, handler http.Handler)

func Server

func Server(port, socket string, srv *http.Server)

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL