colindev / go-mock-api

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

mock api (by golang)

Install

go get github.com/colin1124x/go-mock-api

Usage

// create api map
router := map[string]map[string]string{
    "GET": map[string]string{
        "greet": "hello",
    },
}

// make a quit channel
quit := make(chan bool)

// and run mock server
err := mock_api.Run(":8000", router, quit)

// then do some api request test 

// finally, close mock server
quit <- true

About


Languages

Language:Go 100.0%