Philipp Schrader | 5562df7 | 2022-02-16 20:56:51 -0800 | [diff] [blame^] | 1 | package static |
| 2 | |
| 3 | // A year agnostic way to serve static http files. |
| 4 | import ( |
| 5 | "net/http" |
| 6 | |
| 7 | "github.com/frc971/971-Robot-Code/scouting/webserver/server" |
| 8 | ) |
| 9 | |
| 10 | // Serve pages given a port, directory to serve from, and an channel to pass the errors back to the caller. |
| 11 | func ServePages(scoutingServer server.ScoutingServer, directory string) { |
| 12 | // Serve the / endpoint given a folder of pages. |
| 13 | scoutingServer.Handle("/", http.FileServer(http.Dir(directory))) |
| 14 | } |