mirror of
https://github.com/mgerb/mywebsite
synced 2026-01-10 18:02:51 +00:00
convert server to use relative imports
This commit is contained in:
@@ -9,8 +9,8 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"mywebsite/server/model/daily_sensor"
|
"../../model/daily_sensor"
|
||||||
"mywebsite/server/model/raw_sensor"
|
"../../model/raw_sensor"
|
||||||
)
|
)
|
||||||
|
|
||||||
// handle http request from sensors
|
// handle http request from sensors
|
||||||
@@ -201,7 +201,7 @@ func HandleUniqueDates(w http.ResponseWriter, r *http.Request, ps httprouter.Par
|
|||||||
fmt.Fprint(w, response)
|
fmt.Fprint(w, response)
|
||||||
}
|
}
|
||||||
|
|
||||||
func createResponse(s []daily_sensor.Data, err error) string{
|
func createResponse(s []daily_sensor.Data, err error) string {
|
||||||
var response string
|
var response string
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"mywebsite/server/db"
|
"../../db"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -220,7 +220,7 @@ type Month struct {
|
|||||||
MonthName string `json:"monthname", bson:"monthname"`
|
MonthName string `json:"monthname", bson:"monthname"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetUniqueSensorDates(sensor_location string) ([]Years, error){
|
func GetUniqueSensorDates(sensor_location string) ([]Years, error) {
|
||||||
d := []Years{}
|
d := []Years{}
|
||||||
|
|
||||||
if db.Mongo.Connected() == true {
|
if db.Mongo.Connected() == true {
|
||||||
@@ -237,7 +237,6 @@ func GetUniqueSensorDates(sensor_location string) ([]Years, error){
|
|||||||
bson.M{"$sort": bson.M{"months.month": -1}},
|
bson.M{"$sort": bson.M{"months.month": -1}},
|
||||||
bson.M{"$group": bson.M{"_id": "$year", "months": bson.M{"$push": "$months"}}},
|
bson.M{"$group": bson.M{"_id": "$year", "months": bson.M{"$push": "$months"}}},
|
||||||
bson.M{"$project": bson.M{"year": "$_id", "months": "$months"}},
|
bson.M{"$project": bson.M{"year": "$_id", "months": "$months"}},
|
||||||
|
|
||||||
}).All(&d)
|
}).All(&d)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"mywebsite/server/db"
|
"../../db"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
@@ -6,10 +6,10 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"mywebsite/server/controller/api"
|
"./controller/api"
|
||||||
"mywebsite/server/db"
|
"./db"
|
||||||
"mywebsite/server/route"
|
"./route"
|
||||||
"mywebsite/server/utils"
|
"./utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"mywebsite/server/controller"
|
"../controller"
|
||||||
"mywebsite/server/controller/api"
|
"../controller/api"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Routes() *httprouter.Router {
|
func Routes() *httprouter.Router {
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"mywebsite/server/controller/api"
|
"../controller/api"
|
||||||
"mywebsite/server/db"
|
"../db"
|
||||||
)
|
)
|
||||||
|
|
||||||
//structure for application configurations
|
//structure for application configurations
|
||||||
|
|||||||
Reference in New Issue
Block a user