mirror of
https://github.com/tobiasehlert/teslamateapi.git
synced 2026-02-27 09:54:18 +08:00
cleanup of fmt
specifying port to run
This commit is contained in:
@@ -2,7 +2,6 @@ package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
_ "github.com/lib/pq"
|
||||
@@ -169,6 +168,6 @@ func TeslaMateAPICars() (string, bool) {
|
||||
log.Println("data for /cars created:")
|
||||
|
||||
js, _ := json.Marshal(jsonData)
|
||||
fmt.Printf("%s\n", js)
|
||||
log.Printf("%s\n", js)
|
||||
return string(js), ValidResponse
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
_ "github.com/lib/pq"
|
||||
@@ -193,6 +192,6 @@ func TeslaMateAPICarsCharges(CarID int, ResultPage int, ResultShow int) (string,
|
||||
log.Printf("data for /cars/%d/charges created:", CarID)
|
||||
|
||||
js, _ := json.Marshal(jsonData)
|
||||
fmt.Printf("%s\n", js)
|
||||
log.Printf("%s\n", js)
|
||||
return string(js), ValidResponse
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
_ "github.com/lib/pq"
|
||||
@@ -315,6 +314,6 @@ func TeslaMateAPICarsChargesDetails(CarID int, ChargeID int) (string, bool) {
|
||||
log.Printf("data for /cars/%d/charges/%d created:", CarID, ChargeID)
|
||||
|
||||
js, _ := json.Marshal(jsonData)
|
||||
fmt.Printf("%s\n", js)
|
||||
log.Printf("%s\n", js)
|
||||
return string(js), ValidResponse
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
_ "github.com/lib/pq"
|
||||
@@ -241,6 +240,6 @@ func TeslaMateAPICarsDrives(CarID int, ResultPage int, ResultShow int) (string,
|
||||
log.Printf("data for /cars/%d/drives created:", CarID)
|
||||
|
||||
js, _ := json.Marshal(jsonData)
|
||||
fmt.Printf("%s\n", js)
|
||||
log.Printf("%s\n", js)
|
||||
return string(js), ValidResponse
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
_ "github.com/lib/pq"
|
||||
@@ -378,6 +377,6 @@ func TeslaMateAPICarsDrivesDetails(CarID int, DriveID int) (string, bool) {
|
||||
log.Printf("data for /cars/%d/drives/%d created:", CarID, DriveID)
|
||||
|
||||
js, _ := json.Marshal(jsonData)
|
||||
fmt.Printf("%s\n", js)
|
||||
log.Printf("%s\n", js)
|
||||
return string(js), ValidResponse
|
||||
}
|
||||
|
||||
@@ -575,6 +575,6 @@ func TeslaMateAPICarsStatus(CarID int) (string, bool) {
|
||||
log.Printf("data for /cars/%d/status created:", CarID)
|
||||
|
||||
js, _ := json.Marshal(jsonData)
|
||||
fmt.Printf("%s\n", js)
|
||||
log.Printf("%s\n", js)
|
||||
return string(js), ValidResponse
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
_ "github.com/lib/pq"
|
||||
@@ -119,6 +118,6 @@ func TeslaMateAPICarsUpdates(CarID int, ResultPage int, ResultShow int) (string,
|
||||
log.Printf("data for /cars/%d/updates created:", CarID)
|
||||
|
||||
js, _ := json.Marshal(jsonData)
|
||||
fmt.Printf("%s\n", js)
|
||||
log.Printf("%s\n", js)
|
||||
return string(js), ValidResponse
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
_ "github.com/lib/pq"
|
||||
@@ -128,6 +127,6 @@ func TeslaMateAPIGlobalSettings() (string, bool) {
|
||||
log.Println("data for /globalsettings created:")
|
||||
|
||||
js, _ := json.Marshal(jsonData)
|
||||
fmt.Printf("%s\n", js)
|
||||
log.Printf("%s\n", js)
|
||||
return string(js), ValidResponse
|
||||
}
|
||||
|
||||
+2
-2
@@ -199,8 +199,8 @@ func main() {
|
||||
})
|
||||
})
|
||||
|
||||
// run this on port 8080! :)
|
||||
r.Run()
|
||||
// run this and serve on 0.0.0.0:8080
|
||||
r.Run(":8080")
|
||||
}
|
||||
|
||||
// initAPI func
|
||||
|
||||
Reference in New Issue
Block a user