Codebase list certgraph / f1c9aaae-8abf-4ca0-aac2-23c438a0a3eb/upstream web / web.go
f1c9aaae-8abf-4ca0-aac2-23c438a0a3eb/upstream

Tree @f1c9aaae-8abf-4ca0-aac2-23c438a0a3eb/upstream (Download .tar.gz)

web.go @f1c9aaae-8abf-4ca0-aac2-23c438a0a3eb/upstreamraw · history · blame

// Package web defines a minimal web server for serving the web UI
package web

import (
	"fmt"
	"net/http"
)

//go:generate ./generate.sh

// Serve starts a very basic webserver serving the embed web UI
func Serve(addr string) error {
	http.HandleFunc("/", indexHandler)
	return http.ListenAndServe(addr, nil)
}

func indexHandler(w http.ResponseWriter, r *http.Request) {
	fmt.Fprintf(w, "%s", indexSource)
}