Skip to content

Dockerized Fake server toolkit for development and testing

Notifications You must be signed in to change notification settings

thankyou-payroll/fake-server

Repository files navigation

fake-server

Dockerized Fake server toolkit for development and testing

Environmental Variables (Defaults)

API_PATH = "/api",

Usage

Create ./__mocks__/config.yml

rest:
  - path: /login
    method: post
    validate:
      body:
        email: 'test@test.com'
        password: 'my-password'
    success: login.success
    error: 401.error
  - path: /users
    success: users.success
    error: 401.error
    validate:
      queryString:
        token: my-secret
  - path: /avatar
    multiPart: true
    files:
      - name: avatar
        maxCount: 1
      - name: gallery
        maxCount: 8

rest

Properties

-path: Endpoint you want to mock

method: (Default: GET) HTTP Method

validate: (Optional)

_body_: Object with values to validate for success
_queryString_: Object with values to validate for success

success: (Optional) Name of the yaml file that has the blueprint for the success payload

error: (Optional) Name of the yaml file that has the blueprint for the error payload

multiPart: (Optional) List of InputFiles to emulate

name: name of your InputFile maxCount: Max amount of files allowed on the queue

Using with Docker

version: '3'
services:
  app:
    build: .
    ports:
      - 80:80
    environment:
      - API_URL=http://localhost:3000/my-rest-api
  fake-server:
    image: thankyoupayroll/fake-server
    environment:
      - REST_API_PATH=/my-rest-api
    ports:
      - 3000:3000
    volumes:
      - './__mocks__/:/workspace/responses'

TODO

  • REST
  • MultiPart Upload (Experimental)
  • Stream
  • WebSocket
  • GraphQL

About

Dockerized Fake server toolkit for development and testing

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published