forked from mari-muthu-k/recordMySystem
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.go
30 lines (25 loc) · 789 Bytes
/
app.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
25
26
27
28
29
30
package main
import (
"fmt"
"github.com/gin-gonic/gin"
"github.com/recordMySystem/handlers"
"github.com/recordMySystem/server"
"github.com/recordMySystem/service/database"
)
func appStartup(){
fmt.Println("connecting influx client...")
//Connect influx db
database.ConnectDB(&server.InfluxClient)
defer server.InfluxClient.Close()
server.InfluxWriteAPI = server.InfluxClient.WriteAPIBlocking(server.ORGANIZATION,server.BUCKET)
server.InfluxQueryAPI = server.InfluxClient.QueryAPI(server.ORGANIZATION)
fmt.Println("influx client connected")
}
func main(){
appStartup()
r := gin.New()
r.GET("/getCurrentSystemInfo",handlers.GetCurrentSystemInfo)
r.GET("/getSystemInfo",handlers.GetSystemInfo)
r.POST("/startRecording",handlers.StartRecording)
r.Run("localhost:8080")
}