这是indexloc提供的服务,不要输入任何密码
Skip to content

josuesantos1/moclojer

 
 

Repository files navigation

moclojer

moclojer

Simple and efficient HTTP mock server with specification written in yaml, edn or OpenAPI.

💾 Download the binary with the latest version of moclojer to test on your computer here.

tests linter

📖 See the complete documentation for moclojer here, if you want to contribute (or complement) the documentation, it is here.

YAML example

# This mock register route: GET /hello/:username
- endpoint:
    # Note: the method could be omitted because GET is the default
    method: GET
    path: /hello/:username
    response:
      # Note: the status could be omitted because 200 is the default
      status: 200
      headers:
        Content-Type: application/json
      # Note: the body will receive the value passed in the url using the
      # :username placeholder
      body: >
        {
          "hello": "{{path-params.username}}!"
        }

docker

  • image: ghcr.io/moclojer/moclojer:dev
  • port (default): 8000, if you want to change the port set the environment variable PORT
docker run -it \
  -p 8000:8000 -v $(pwd)/moclojer.yml:/app/moclojer.yml \
  ghcr.io/moclojer/moclojer:dev

we Two available versions:

  • dev: main branch docker image
  • latest: latest stable version image

manual (Linux & macOS)

bash < <(curl -s https://raw.githubusercontent.com/moclojer/moclojer/main/install.sh)

If you are using Linux you maybe need sudo.

CLI Usage

  • clj -M:run [OPTIONS]
  • java -jar moclojer.jar [OPTIONS]
  • moclojer_Linux [OPTIONS]

Options

-c, --config

Config path or the CONFIG environment variable. [Default: moclojer.yml]

-m, --mocks

OpenAPI v3 mocks path or the MOCKS environment variable.

-h, --help

Show help information

-v, --version

Show version information

💻 dev environment

We use git submodule to integrate with OpenAPI v3 specification, if you want to use it, you will need to update the git submodule code.

git submodule update -f --init

run

clj -M:run

test

clj -M:test

moclojer.jar generate

clj -A:dev -M --report stderr -m moclojer.build

About

Simple and efficient HTTP mock server with specification in yaml, edn or OpenAPI

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Clojure 88.5%
  • Shell 7.1%
  • Dockerfile 4.4%