Sign inSign up

jvrmaia/server-mock

By jvrmaia

Updated over 6 years ago

Image
0

443

jvrmaia/server-mock repository overview

How to

Write your config.toml like this example:

debug = true
listen = "0.0.0.0:8080"
write_timeout = "15s"
read_timeout = "15s"
idle_timeout = "2m"

[[routes]]
type = "generic"
path = '/'
status_code = 200
headers = '{"Content-Type":"text/plain"}'
body = 'oi'

[[routes]]
type = "generic"
path = '/health'
status_code = 200
headers = '{"Content-Type":"application/json"}'
body = '{"status":"ok"}'

[[routes]]
type = "generic"
path = '/panic'
status_code = 500
headers = '{"Content-Type":"application/json"}'
body = '{"error":"database out"}'

[[routes]]
path = '/legacy'
status_code = 200
headers = '{"Content-Type":"application/xml"}'
body = '<xml><status>error</status></xml>'

[[routes]]
type = "echo"
path = '/echo'
status_code = 200
headers = '{"Content-Type":"text/plain"}'

To run:

docker run --rm -p 8080:8080 -v $PWD/config.toml:/app/config.toml jvrmaia/server-mock:0.1

Tag summary

Content type

Image

Digest

Size

6.9 MB

Last updated

over 6 years ago

docker pull jvrmaia/server-mock:0.3