go-mocker

command module
v0.0.0-...-0419ecd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 8, 2020 License: MIT Imports: 8 Imported by: 0

README

go-mocker

A simple http mock server implemented by Golang.

How to Use

install
go get github.com/amooly/go-mocker
Start a Http Server

Firstly you need to create a json file to define the server config, just like this(You can also see the sample file here):

{
  "server": {
    "address": "0.0.0.0",
    "port": 8080
  },
  "routes": [
    {
      "request": {
        "method": "GET",
        "url": "/hello"
      },
      "response": {
        "status": 200,
        "body": "{\"message\": \"World!\"}"
      }
    }
  ]
}

After Then, run the command. The format of go-mocker command is :

go-mocker [{path_to_mock_file}]

You can define your own file using absolute path or relative path. Or it will use the sample file

Inspired by go-http-mock-server

Documentation

Overview

This package implements a simple http server mocker. Quick Start:

go-mocker [{path_to_mock_file}]

there is a default file :sample/mock.json.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL