Giter Club home page Giter Club logo

gmock's Introduction

gmock

Build Status Coverage Status Go Report Card Latest Version License Repo Size

以文件为基准,最简单的 APIs 模拟工具

接口未至,开发先行

这里有一些 example 已经部署到 heroku

特性:

  • 支持所有 HTTP 方法
  • 以最低的成本兼容 JSON 接口
  • 实时更改接口,无需重启服务
  • 自定义模版,满足复杂需求
  • 支持文件流,例如返回图片,下载等
  • 支持渲染 HTML/Markdown 文件

安装

  1. Shell (Mac/Linux)
curl -fsSL https://github.com/release-lab/install/raw/v1/install.sh | bash -s -- -r=axetroy/gmock
  1. PowerShell (Windows):
$r="axetroy/gmock";iwr https://github.com/release-lab/install/raw/v1/install.ps1 -useb | iex
  1. Github Release Page 下载 (全平台支持)

下载可执行文件,并且把它加入到$PATH 环境变量中

  1. 使用 Golang 从源码中构建并安装 (全平台支持)
go install github.com/axetroy/gmock/cmd/whatchanged@latest

快速开始

首先先创建一个存放 APIs 文件的目录

$ mkdir -p ./apis/v1

然后在创建对应的 APIs 文件

$ touch ./apis/v1/ping.get.json
$ echo "{\"body\": \"tong\"}" > ./apis/v1/ping.get.json

运行命令

# gmock <接口文件目录>
$ gmock ./apis
$ curl http://localhost:8080/v1/ping
tong

文档

开源许可

The MIT License

gmock's People

Contributors

axetroy avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

wuchunfu xwinie

gmock's Issues

支持 any 方法

api.any.json 文件

优先级比 api.get.json 等具体方法等的优先级低。作为 fallback 的一种方法。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.