-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
24 lines (18 loc) · 673 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Backend code for the APIs that powers The Medialist.
package main
import (
"github.com/gorilla/mux"
"log"
"net/http"
)
func main() {
openLogFile("dev.log")
log.SetFlags(log.Ldate | log.Ltime)
router := mux.NewRouter().StrictSlash(true)
router.HandleFunc("/articles/recent/", getRecentArticlesHandler)
router.HandleFunc("/articles/detail/{slug}/", getArticleDetailHandler)
router.HandleFunc("/bookmark/list/", getAuthorBookmarkedArticlesPksHandler)
router.HandleFunc("/authors/authenticate/", getAuthTokenFromUsernameAndPasswordHandler)
log.Println("Listening on http://localhost:8080/")
log.Fatal(http.ListenAndServe(":8080", requestLogger(router)))
}