Move everything back to root dir

This commit is contained in:
Joakim Hellsén 2024-02-14 04:40:48 +01:00
commit 1fa8351d11
19 changed files with 257 additions and 300 deletions

34
main.go Normal file
View file

@ -0,0 +1,34 @@
package main
import (
"log"
"net/http"
)
func init() { log.SetFlags(log.LstdFlags | log.Lshortfile) }
func main() {
log.Print("Starting server")
// Create a new ServeMux
mux := http.NewServeMux()
// Routes
mux.HandleFunc("/", IndexHandler)
mux.HandleFunc("/api", ApiHandler)
mux.HandleFunc("/feeds", FeedsHandler)
mux.HandleFunc("/add", AddFeedHandler)
mux.HandleFunc("/upload_opml", UploadOpmlHandler)
// Create server
server := &http.Server{
Addr: "127.0.0.1:8000",
Handler: mux,
}
log.Print("Server started on http://localhost:8000/ <Ctrl-C> to stop")
if err := server.ListenAndServe(); err != nil && err != http.ErrServerClosed {
log.Fatalf("ListenAndServe(): %v", err)
}
}