github.com/emc-advanced-dev/unik@v0.0.0-20190717152701-a58d3e8e33b7/docs/examples/example_go_static_fileserver/example_go_app.go (about)

     1  package main
     2  
     3  import (
     4  	"fmt"
     5  	"net/http"
     6  	"os"
     7  )
     8  
     9  func main() {
    10  	http.Handle("/", http.FileServer(http.Dir("./static")))
    11  	fmt.Printf("listening on port :8080")
    12  	wd, err := os.Getwd()
    13  	if err != nil {
    14  		panic(err)
    15  	}
    16  	fmt.Printf("cwd: %s", wd)
    17  	http.ListenAndServe(":8080", nil)
    18  }
    19  
    20  func handler(w http.ResponseWriter, r *http.Request) {
    21  	fmt.Fprintf(w, "my first unikernel!")
    22  }