Categorygithub.com/medinam/mockgopher
modulepackage
0.1.0
Repository: https://github.com/medinam/mockgopher.git
Documentation: pkg.go.dev

# README

MockGopher

Is a library and CLI/GUI application to make mock server in a ease.

CLI Instalation

To actually use MockGopher you need to install Go first, you can find how to install it in https://golang.org/. Then you can run the go get command.

go get -u github.com/medinam/mockgopher/cli/mockgopher

Now you can use MockGopher normally, see the instructions below.

CLI Usage

You can see some examples in cli/examples folder.

Project Structure

.
├── resources            # Files that can be served
├── templates            # All templates go here
└── project.toml         # Configuration file, see "The TOML file"

The TOML File

host = "0.0.0.0"
port = 3000

[[routes]]
  [routes.request]
    path = "/posts"
    method = "GET"
    headers = [
      { key = "Content-Type", value = "application/json.*" }
    ]
  [routes.response]
    headers = [
      { key = "Content-Type", value = "application/json" }
    ]
    template = "get-posts.json"

[[routes]]
  [routes.request]
    path = "/media/avatar/{file}"
    method = "GET"
  [routes.response]
    headers = [
      { key = "Content-Type", value = "image/svg+xml" }
    ]
    template = "get-posts.json"
    resources = [
      "avatars/25789.svg",
      "avatars/527688.svg",
      "avatars/7896451.svg",
      "avatars/9785412.svg",
      "avatars/25678412.svg"
    ]

Serve

mockgopher.exe .\path\to\project.toml

GUI Usage

The GUI of MockGopher is actually under development, you can see updates here or follow me @luismedina_git on Twitter.

# Packages

No description provided by the author
No description provided by the author

# Functions

NewBlueprint creates a new instance with some default values.
NewFaker creates a Faker intance using the original library implementation.
NewStdout return a Stdout object thats use the standar output.
No description provided by the author

# Structs

Blueprint represent how should be serve the routes.
Faker it's just a struct thats wraps faker packages interfaces.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Stdout is used to print stuff in the standar output implementing io.Writer.

# Interfaces

No description provided by the author