summary refs log tree commit diff stats
path: root/main.go
diff options
context:
space:
mode:
authorBen Morrison <ben@gbmor.dev>2019-05-11 03:32:00 -0400
committerBen Morrison <ben@gbmor.dev>2019-05-11 03:32:00 -0400
commitd4c05d21a4de2fe8f492957b66f40aa5e6757dca (patch)
tree620378cd1968cf31718c7ba1a03939f5411ac463 /main.go
parent474ffad421eee04a50cbdd5cfbc2b396c24dc521 (diff)
downloadgetwtxt-d4c05d21a4de2fe8f492957b66f40aa5e6757dca.tar.gz
skeleton handlers responding
Diffstat (limited to 'main.go')
-rw-r--r--main.go14
1 files changed, 8 insertions, 6 deletions
diff --git a/main.go b/main.go
index 06d124a..d8a0614 100644
--- a/main.go
+++ b/main.go
@@ -8,17 +8,19 @@ import (
 	"github.com/gorilla/mux"
 )
 
+const getwtxt = "0.1"
+
 func main() {
-	log.Printf("getwtxt v0.1\n")
+	log.Printf("getwtxt " + getwtxt + "\n")
 
 	serv := mux.NewRouter()
 
 	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)
+	serv.HandleFunc("/{api:(?:api|api/)}", apiBaseHandler)
+	serv.HandleFunc("/api/{format:(?:plain|plain/)}", apiFormatHandler)
+	serv.HandleFunc("/api/{format:(?:plain)}/{endpoint:(?:mentions|mentions/|users|users/|tweets|tweets/)}", apiEndpointHandler)
+	serv.HandleFunc("/api/{format:(?:plain)}/tags/{tags:[a-zA-Z0-9]+}", apiTagsHandler)
+	serv.HandleFunc("/api/{format:(?:plain)}/{tagpathfixer:(?:tags|tags/)}", apiTagsBaseHandler)
 
 	log.Fatalln(http.ListenAndServe(":8080", handlers.CompressHandler(serv)))
 }
164' href='#n164'>164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239