-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmain.go
More file actions
25 lines (19 loc) · 706 Bytes
/
main.go
File metadata and controls
25 lines (19 loc) · 706 Bytes
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
package main
import (
"log"
"net/http"
"os"
"github.com/bobsar0/AutoTrade/app"
"github.com/gorilla/handlers"
)
//Program starts here
func main() {
s := app.NewSession() //Initializes new session
h := app.NewAppHandler(s) //Passes the session to initialize a new instance of appHandler
//Starting the goroutines
go app.GetTicker(s.GetTickerChan)
go app.GetBalance(s.GetBalanceChan)
go app.PlaceOrder(s.PlaceOrderChan)
log.Println("Connecting to server on port 8000...")
log.Fatalln(http.ListenAndServe(":8000", handlers.CombinedLoggingHandler(os.Stderr, h))) //Set listening port (:8080). Handler is h indicating that chi router is used. log.Fatal checks for error and outputs if any.
}