blob: 06d124a9a5b87ee757dc6eef2279765fa90a235c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
package main
import (
"log"
"net/http"
"github.com/gorilla/handlers"
"github.com/gorilla/mux"
)
func main() {
log.Printf("getwtxt v0.1\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)
log.Fatalln(http.ListenAndServe(":8080", handlers.CompressHandler(serv)))
}
|