Skip to content

gostub/gostub

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gostub

Simple http stub server by golang

gostub

Requirement

Only Go language

Installation

go get github.com/gostub/gostub

Usage

$ gostub -h

Usage of gostub:
  -o string
    	output path (e.g. 'tests' -> ./tests)
  -p string
    	port number (default "8181")

Example

Add route GET /hello/world

.
└── hello
    └── world
        ├── $GET.json
        └── response.json

$GET.json

{
  "default" : {
    "body": "response.json",
    "status": 200
  }
}

response.json

{
  "hello": "world!"
}

Response

launch

$ gostub

curl

$ curl http://localhost:8181/hello/world

{
  "hello": "world!"
}

Shutdown

$ curl http://localhost:8181/gostub/shutdown