1
0
mirror of https://github.com/mgerb/mywebsite synced 2026-01-11 18:32:50 +00:00

getting close to finishing temperature data api

This commit is contained in:
2016-05-17 23:26:15 -05:00
parent 6627cb4cd6
commit b6d5854250
16 changed files with 693 additions and 86 deletions

View File

@@ -2,16 +2,26 @@ package route
import (
"github.com/julienschmidt/httprouter"
"log"
"net/http"
"github.com/mgerb42/mywebsite/controller"
"github.com/mgerb42/mywebsite/controller/api"
)
func Routes() *httprouter.Router {
log.Println("Server Started")
r := httprouter.New()
r.GET("/api/:fname/:lname", api.TestApiCall)
r.GET("/api/storedata", api.HandleSensorRequest)
r.GET("/api/allsensors", api.HandleAllSensors)
r.GET("/api/sensor/:location", api.HandleSensorByLocation)
r.GET("/api/sensor/:location/:year", api.HandleSensorByLocationYear)
r.GET("/api/sensor/:location/:year/:month", api.HandleSensorByLocationMonth)
r.GET("/discord", controller.Discord)
//set up public folder path
r.ServeFiles("/public/*filepath", http.Dir("./public"))