/mocker-api-faster

Mocker API using Typescript + NodeJS

Primary LanguageTypeScript

Usage

  1. Clone the Example project
  2. install the dependencies yarn or npm install
  3. Make the requests and see the results

cURL

List Mocks

curl --request GET \
  --url http://localhost:8000/mocks

List all - 1s Delay - Base fixture

curl --request GET \
  --url http://localhost:8000/users \
  --header 'expected-delay: 1000' \
  --header 'expected-fixture-type: base' \
  --header 'expected-status-code: 200'

Find - 1s Delay - Base fixture

  curl --request GET \
  --url http://localhost:8000/users/123 \
  --header 'expected-delay: 1000' \
  --header 'expected-fixture-type: base' \
  --header 'expected-status-code: 200'

Create - Success - 1s Delay - Base Fixture

  curl --request POST \
    --url http://localhost:8000/users \
    --header 'Content-Type: application/json' \
    --header 'expected-delay: 1000' \
    --header 'expected-fixture-type: base' \
    --header 'expected-status-code: 201' \
    --data '{}'

Create - Conflict - 1s Delay - Conflict Fixture

  curl --request POST \
    --url http://localhost:8000/users \
    --header 'Content-Type: application/json' \
    --header 'expected-delay: 1000' \
    --header 'expected-fixture-type: conflict' \
    --header 'expected-status-code: 400' \
    --data '{}'

Create - Bad Request - 1s Delay - Base Fixture

  curl --request POST \
   --url http://localhost:8000/users \
   --header 'Content-Type: application/json' \
   --header 'expected-delay: 1000' \
   --header 'expected-fixture-type: base' \
   --header 'expected-status-code: 400' \
   --data '{}'