fathom/ana.go

25 lines
529 B
Go
Raw Normal View History

package main
import (
"net/http"
"github.com/dannyvankooten/ana/core"
"github.com/dannyvankooten/ana/api"
)
2016-11-21 16:36:25 +00:00
// TODO: Use Gorilla Mux router.
// TODO: Authentication.
func main() {
db := core.SetupDatabaseConnection()
defer db.Close()
// register routes
api.RegisterRoutes()
http.HandleFunc("/collect", api.CollectHandler)
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
http.ServeFile(w, r, "./static/" + r.URL.Path[1:])
})
http.ListenAndServe(":8080", nil)
}