-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
50 lines (36 loc) · 984 Bytes
/
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
41
42
43
44
45
46
47
48
49
50
package main
import (
"log"
"net/url"
"strings"
"github.com/vincentgong3mm/golanghttprest/seaside/mongowrap"
"go.mongodb.org/mongo-driver/bson"
)
func TestHTTPRequest() {
NewServe()
}
func TestMongoDB() {
config := mongowrap.LoadDBSetting("./db_setting.json")
conn := mongowrap.NewMongoConn()
conn.Connect(config)
findCol := mongowrap.FindCollection{DBName: "seaside_user", CollectionName: "user", Query: bson.M{"user_name": "mbell"}}
if err := conn.Find(&findCol); err != nil {
log.Fatal("aaa", err)
return
}
log.Println(findCol)
}
func main() {
NewSlog()
sl.Info.Println("Hello World!")
NewServe()
//TestMongoDB()
handler := &SearchUser{}
// response := setUpAPITest(handler, "GET", "/user", nil)
// sl.Info.Println(response)
param := url.Values{}
param.Add("mykey", "myvalue")
param.Add("mykey2222", "myvalue2222")
response2 := setUpAPITest(handler, "POST", "/user", strings.NewReader("test body string..."))
sl.Info.Println(response2)
}