summary refs log tree commit diff stats
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/main.go b/main.go
index 374b94f..06d124a 100644
--- a/main.go
+++ b/main.go
@@ -5,14 +5,20 @@ import (
 	"net/http"
 
 	"github.com/gorilla/handlers"
+	"github.com/gorilla/mux"
 )
 
 func main() {
 	log.Printf("getwtxt v0.1\n")
 
-	serv := http.NewServeMux()
+	serv := mux.NewRouter()
 
-	serv.HandleFunc("/api/", apiHandler)
+	serv.HandleFunc("/", indexHandler)
+	serv.HandleFunc("/api/", apiBaseHandler)
+	serv.HandleFunc("/api/{format:plain}", apiFormatHandler)
+	serv.HandleFunc("/api/{format:plain}/{endpoint:mentions|users|tweets}", apiEndpointHandler)
+	serv.HandleFunc("/api/{format:plain}/tags/{tags:[a-zA-Z0-9]+}", apiTagsHandler)
+	serv.HandleFunc("/api/{format:plain}/tags", apiTagsBaseHandler)
 
 	log.Fatalln(http.ListenAndServe(":8080", handlers.CompressHandler(serv)))
 }