-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
40 lines (34 loc) · 1.01 KB
/
main.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
31
32
33
34
35
36
37
38
39
40
package main
import (
"fmt"
"log"
"github.com/buaazp/fasthttprouter"
"github.com/davidobando99/APIRestWithGo/controller"
"github.com/davidobando99/APIRestWithGo/database"
"github.com/valyala/fasthttp"
)
func main() {
db := database.Connection()
controller.DataBase = db
database.CreateTable(controller.DataBase)
router := fasthttprouter.New()
router.GET("/domains/", controller.GetDomainsEndpoint)
router.GET("/domains/:host", controller.GetDomainEndpoint)
fmt.Println("Server Listen at Port 8000")
log.Fatal(fasthttp.ListenAndServe(":8000", router.Handler))
/*
proving database
database.CreateTable(db)
database.InsertDomain(db, "hla.com", "A", "A")
database.InsertDomain(db, "b.com", "A", "A")
database.GetDomains(db)
//fmt.Println()
*/
//servers := database.GetDomains(db)
//fmt.Println("misServers")
//fmt.Println(servers)
//database.UpdateDomain(db, "hla.com", "B", "B")
//database.SearchDomain("truora.com")
//domain := database.SearchDomain(db, "truor.com")
//fmt.Println(domain.Host)
}