1234567891011121314151617181920212223 |
- package main
- import (
- "log"
- "net/http"
- )
- func webServer(Dir string, tmpDir string, Port string) {
- fs := http.FileServer(http.Dir(Dir))
- http.Handle("/", fs)
- http.Handle("/output/", http.StripPrefix("/output/", http.FileServer(http.Dir(tmpDir))))
- //SYSTEM FUNCTION
- http.HandleFunc("/sendcommand", SendCommand)
- http.HandleFunc("/log", ReadLog)
- http.HandleFunc("/log/from", ReadLogFrom)
- err := http.ListenAndServe(Port, nil)
- if err != nil {
- log.Fatal(err)
- }
- }
|