-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
46 lines (39 loc) · 854 Bytes
/
main.go
File metadata and controls
46 lines (39 loc) · 854 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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package main
import (
"log"
"strings"
"io/ioutil"
"github.com/Hackerry/Vocabulary_Tracker/server"
"github.com/Hackerry/Vocabulary_Tracker/api"
)
func main() {
// Get api
data, err := ioutil.ReadFile("api_key")
if err != nil {
log.Println(err)
}
lines := strings.Split(string(data), "\n")
var a *api.API = nil
// Comment out unused API with #
for _, line := range lines {
if line[0] != '#' {
p := strings.Split(line, " ")
a = api.NewAPI(p[0], p[1])
log.Println("API URL:", a.Url)
log.Println("Using parser:", p[1])
break
}
}
if a == nil {
log.Fatal("Can't initialize api\n")
}
s := server.NewServer(a)
s.Serve()
// Test get word
// resp := a.Query("voluminous")
// if resp != nil {
// log.Println(string(resp))
// } else {
// log.Println("Empty")
// }
}