0.3.9 • Published 6 years ago

gunubin-mock-server v0.3.9

Weekly downloads
10
License
MIT
Repository
github
Last release
6 years ago

gunubin-mock-server

Build Status codecov semantic-release

Installation

npm install --save-dev gunubin-mock-server

Usage

import GunubinMockServer from 'gunubin-mock-server';

const mockServer = new GunubinMockServer();
mockServer.start({
  glob: 'pathto/schema.json',
  port: 3000
});

mockServer.extend('/todo', {
  foo: 'bar' 
});

mockServer.extend('/todo', req => {
  return {
    foo: req.params.param1
  }
});

mockServer.extendResource('todo', {
  foo: 'bar' 
});

mockServer.override('/todo', {
  foo: 'foo',
  bar: 'bar'
});

mockServer.overrideResource('todo', {
  foo: 'foo',
  bar: 'bar'
});

mockServer.globalValidResponseSchemata = [{
  'title': 'エラー',
  'description': 'エラーレスポンスを表します。',
  'stability': 'prototype',
  'strictProperties': true,
  'type': [
    'object'
  ],
  'properties': {
    'type': {
      'description': 'エラーの種別',
      'enum': [
        'foo_error',
        'bar_error',
      ]
    },
    'status': {
      'status': {
        'description': 'ステータスコード',
        'example': 400,
        'readOnly': true,
        'type': [
          'integer'
        ]
      }
    }
  },
  'required': [
    'type',
    'status'
  ]
}];

mockServer.override('/task', {
  type: 'hoge_error',
  status: 400
});
0.3.9

6 years ago

0.3.7

6 years ago

0.3.6

6 years ago

0.3.5

6 years ago

0.3.4

6 years ago

0.3.3

6 years ago

0.3.2

6 years ago

0.3.1

6 years ago

0.3.0

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.2.4

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago