mock server.
# from npm
npm install @saber2pr/mock -g
# from github
git clone https://github.com/Saber2pr/mock.git
# in you workspace root, execute:
smock # http://localhost:2333
# smock <port>, like:
smock 3000 # http://localhost:3000
# quick start
npx @saber2pr/mock
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 :)
npm install
npm start
npm test
Author: saber2pr
you should write ts in /src
you should make test in /src/test
export your core in /src/index.ts!