27 lines
484 B
Go
27 lines
484 B
Go
package web
|
|
|
|
import (
|
|
"fmt"
|
|
"net/http"
|
|
)
|
|
|
|
func StartServer() {
|
|
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
|
fmt.Fprintf(w, "Barcodes")
|
|
})
|
|
|
|
http.HandleFunc("/help", helpTemplate)
|
|
|
|
http.HandleFunc("/generate", generateBarcode)
|
|
|
|
http.HandleFunc("/generate/formatted", generateFormattedBarcode)
|
|
|
|
port := ":8500"
|
|
fmt.Printf("Server listening on port %s\n", port)
|
|
|
|
err := http.ListenAndServe(port, nil)
|
|
if err != nil {
|
|
fmt.Println("Error: ", err)
|
|
}
|
|
}
|