Add Docker
This commit is contained in:
@@ -2,11 +2,12 @@ package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"github.com/gorilla/websocket"
|
||||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
|
||||
"github.com/gorilla/websocket"
|
||||
)
|
||||
|
||||
var upgrader = websocket.Upgrader{
|
||||
@@ -59,7 +60,7 @@ func main() {
|
||||
mux.HandleFunc("/main.css", func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Add("Content-Type", "text/css")
|
||||
w.WriteHeader(http.StatusOK)
|
||||
file, _ := os.Open("./main.css")
|
||||
file, _ := os.Open("./display/main.css")
|
||||
defer file.Close()
|
||||
io.Copy(w, file)
|
||||
})
|
||||
@@ -74,7 +75,8 @@ func main() {
|
||||
}()
|
||||
|
||||
mux := http.NewServeMux()
|
||||
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||
mux.Handle("/", http.FileServer(http.Dir("./display/")))
|
||||
mux.HandleFunc("/socket", func(w http.ResponseWriter, r *http.Request) {
|
||||
con, err := upgrader.Upgrade(w, r, nil)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
@@ -99,5 +101,5 @@ func main() {
|
||||
}
|
||||
}
|
||||
})
|
||||
log.Println(http.ListenAndServe("127.0.0.1:8081", mux))
|
||||
log.Println(http.ListenAndServe(":8081", mux))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user