All Projects → Thiht → Smocker

Thiht / Smocker

Licence: mit
Smocker is a simple and efficient HTTP mock server and proxy.

Programming Languages

go
31211 projects - #10 most used programming language
typescript
32286 projects

Projects that are alternatives of or similar to Smocker

Wiremockui
Wiremock UI - Tool for creating mock servers, proxies servers and proxies servers with the option to save the data traffic from an existing API or Site.
Stars: ✭ 38 (-91.83%)
Mutual labels:  proxy, mock, mock-server
Mockttp
Powerful friendly HTTP mock server & proxy
Stars: ✭ 346 (-25.59%)
Mutual labels:  proxy, integration-testing, mock-server
Mastermind
Man in the middle testing
Stars: ✭ 341 (-26.67%)
Mutual labels:  proxy, test, mock
Mockoon
Mockoon is the easiest and quickest way to run mock APIs locally. No remote deployment, no account required, open source.
Stars: ✭ 3,448 (+641.51%)
Mutual labels:  api, mock, mock-server
Httpmock
HTTP mocking library for Rust.
Stars: ✭ 76 (-83.66%)
Mutual labels:  test, mock, mock-server
zmock
zmock--http接口的mock平台
Stars: ✭ 98 (-78.92%)
Mutual labels:  mock, test, mock-server
Mockman
Manage and start the mock servers on your local platform easily
Stars: ✭ 281 (-39.57%)
Mutual labels:  mock, mock-server
Stubby4j
An HTTP stub server for testing application interactions with web services (REST, etc) & external system stubbing for easy testing
Stars: ✭ 300 (-35.48%)
Mutual labels:  integration-testing, mock-server
Mockserver
MockServer enables easy mocking of any system you integrate with via HTTP or HTTPS with clients written in Java, JavaScript and Ruby. MockServer also includes a proxy that introspects all proxied traffic including encrypted SSL traffic and supports Port Forwarding, Web Proxying (i.e. HTTP proxy), HTTPS Tunneling Proxying (using HTTP CONNECT) and…
Stars: ✭ 3,479 (+648.17%)
Mutual labels:  proxy, mock-server
Php Curl Class
PHP Curl Class makes it easy to send HTTP requests and integrate with web APIs
Stars: ✭ 2,903 (+524.3%)
Mutual labels:  api, proxy
Annon.api
Configurable API gateway that acts as a reverse proxy with a plugin system.
Stars: ✭ 306 (-34.19%)
Mutual labels:  api, proxy
Mockito
HTTP mocking for Rust!
Stars: ✭ 335 (-27.96%)
Mutual labels:  test, mock
Chn Eolinker Ams Lite 4.0 For Java
中国最大的API接口管理平台,3.x开源发行版,支持多国语言[英语、简体中文、繁体中文]
Stars: ✭ 275 (-40.86%)
Mutual labels:  api, mock-server
Pushpin
Proxy server for adding push to your API
Stars: ✭ 3,050 (+555.91%)
Mutual labels:  api, proxy
Service Pattern Go
Simple clean Go REST API architecture with dependency injection and mocking example, following SOLID principles.
Stars: ✭ 449 (-3.44%)
Mutual labels:  api, mock
Manba
HTTP API Gateway
Stars: ✭ 3,000 (+545.16%)
Mutual labels:  api, proxy
Dredd
Language-agnostic HTTP API Testing Tool
Stars: ✭ 3,770 (+710.75%)
Mutual labels:  api, integration-testing
Service Proxy
API gateway for REST and SOAP written in Java.
Stars: ✭ 355 (-23.66%)
Mutual labels:  api, proxy
Mimic
Seamless client side mocking
Stars: ✭ 380 (-18.28%)
Mutual labels:  test, mock
mokker
The mock does not mock you. The video: https://www.youtube.com/watch?v=gGLNJpC-Ov0
Stars: ✭ 13 (-97.2%)
Mutual labels:  mock, mock-server

Smocker

Build Status Netlify Status Docker Repository Github Release Go Report Card License

Smocker (server mock) is a simple and efficient HTTP mock server.

The documentation is available on smocker.dev.

Table of contents

Installation

With Docker

docker run -d \
  --restart=always \
  -p 8080:8080 \
  -p 8081:8081 \
  --name smocker \
  thiht/smocker

Manual Deployment

# This will be the deployment folder for the Smocker instance
mkdir -p /opt/smocker && cd /opt/smocker
wget -P /tmp https://github.com/Thiht/smocker/releases/latest/download/smocker.tar.gz
tar xf /tmp/smocker.tar.gz
nohup ./smocker -mock-server-listen-port=8080 -config-listen-port=8081 &

Healthcheck

curl localhost:8081/version

User Interface

Smocker exposes a configuration user interface. You can access it in your web browser on http://localhost:8081/.

History

Mocks

Usage

Smocker exposes two ports:

  • 8080 is the mock server port. It will expose the routes you register through the configuration port
  • 8081 is the configuration port. It's the port you will use to register new mocks. This port also exposes a user interface.

Hello, World!

To register a mock, you can use the YAML and the JSON formats. A basic mock might look like this:

# helloworld.yml
# This mock register two routes: GET /hello/world and GET /foo/bar
- request:
    # Note: the method could be omitted because GET is the default
    method: GET
    path: /hello/world
  response:
    # Note: the status could be omitted because 200 is the default
    status: 200
    headers:
      Content-Type: application/json
    body: >
      {
        "hello": "Hello, World!"
      }

- request:
    method: GET
    path: /foo/bar
  response:
    status: 204

You can then register it to the configuration server with the following command:

curl -XPOST \
  --header "Content-Type: application/x-yaml" \
  --data-binary "@helloworld.yml" \
  localhost:8081/mocks

After your mock is registered, you can query the mock server on the specified route, so that it returns the expected response to you:

$ curl -i localhost:8080/hello/world
HTTP/1.1 200 OK
Content-Type: application/json
Date: Thu, 05 Sep 2019 15:49:32 GMT
Content-Length: 31

{
  "hello": "Hello, World!"
}

To cleanup the mock server without restarting it, you can execute the following command:

curl -XPOST localhost:8081/reset

For more advanced usage, please read the project's documentation.

Development

Backend

The backend is written in Go. You can use the following commands to manage the development lifecycle:

  • make start: start the backend in development mode, with live reload
  • make build, make VERSION=xxx build: compile the code and generate a binary
  • make lint: run static analysis on the code
  • make format: automatically format the backend code
  • make test: execute unit tests
  • make test-integration: execute integration tests

Frontend

The frontend is written with TypeScript and React. You can use the following commands to manage the development lifecycle:

  • yarn install: install the dependencies
  • yarn start: start the frontend in development mode, with live reload
  • yarn build: generate the transpiled and minified files and assets
  • yarn lint: run static analysis on the code
  • yarn format: automatically format the frontend code
  • yarn test: execute unit tests
  • yarn test:watch: execute unit tests, with live reload

Documentation

The documentation is written in Markdown using Vuepress. You can use the following commands to manage the documentation:

  • yarn install: install the dependencies
  • yarn docs:generate: regenerate documentation screenshots (require the whole application to be started on the default ports)
  • yarn docs:dev: start the documentation in development mode, with live reload
  • yarn docs:build: generate the static production documentation

Docker

The application can be packaged as a standalone Docker image. You can use the following commands to manage the development lifecycle:

  • make build-docker, make VERSION=xxx build-docker: build the application as a Docker image
  • make start-docker, make VERSION=xxx start-docker: run a Smocker Docker image

Caddy

If you need to test Smocker with a base path, you can use the Caddyfile provided in the repository (Caddy v2):

  • make start-release, make VERSION=xxx start-release: create a released version of Smocker and launch it with /smocker/ as base path
  • make start-caddy: start Caddy to make Smocker accessible at http://localhost:8082/smocker/

Authors

Contributors

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].