/mock

mock server.

Primary LanguageTypeScript

@saber2pr/mock

npm

mock server.

# from npm
npm install @saber2pr/mock -g

# from github
git clone https://github.com/Saber2pr/mock.git

Usage

# in you workspace root, execute:
smock # http://localhost:2333

# smock <port>, like:
smock 3000 # http://localhost:3000

# quick start
npx @saber2pr/mock

in you workspace root must has a mock.json file:

for example:

{
  "/": "hello world!",
  "api": {
    "user": ["saber2pr", "nanasaki"],
    "com": "com"
  },
  "other": "233"
}

the json data will be parsed to an array:

;[
  { key: '/', value: 'hello world!' },
  { key: '/api/user', value: ['saber2pr', 'nanasaki'] },
  { key: '/api/com', value: 'com' },
  { key: '/other', value: '233' }
]

then config to server :)


start

npm install
npm start

npm test

Author: saber2pr


develope and test

you should write ts in /src

you should make test in /src/test

export your core in /src/index.ts!