Test web-server
This commit is contained in:
@@ -2,7 +2,9 @@ package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"github.com/dedkovd/noolite"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@@ -12,6 +14,9 @@ func main() {
|
||||
red := flag.Int("r", 0, "Red channel")
|
||||
green := flag.Int("g", 0, "Green channel")
|
||||
blue := flag.Int("b", 0, "Blue channel")
|
||||
|
||||
http_port := flag.Int("p", -1, "Http port")
|
||||
|
||||
flag.Parse()
|
||||
|
||||
if *channel == -1 {
|
||||
@@ -60,4 +65,13 @@ func main() {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
if *http_port != -1 {
|
||||
http.HandleFunc("/switch", func(w http.ResponseWriter, r *http.Request) {
|
||||
fmt.Fprintf(w, "%q", r.URL.RawQuery)
|
||||
n.Switch(7)
|
||||
})
|
||||
|
||||
http.ListenAndServe(":8080", nil)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user