https://github.com/saber2pr/mock
mock server.
https://github.com/saber2pr/mock
mock server
Last synced: about 2 months ago
JSON representation
mock server.
- Host: GitHub
- URL: https://github.com/saber2pr/mock
- Owner: Saber2pr
- Created: 2019-05-17T14:56:06.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2023-12-29T07:54:17.000Z (over 2 years ago)
- Last Synced: 2025-02-04T22:02:48.843Z (over 1 year ago)
- Topics: mock, server
- Language: TypeScript
- Homepage:
- Size: 7.81 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# @saber2pr/mock
[](https://www.npmjs.com/package/@saber2pr/mock)
> mock server.
```bash
# from npm
npm install @saber2pr/mock -g
# from github
git clone https://github.com/Saber2pr/mock.git
```
# Usage
```bash
# in you workspace root, execute:
smock # http://localhost:2333
# smock , like:
smock 3000 # http://localhost:3000
# quick start
npx @saber2pr/mock
```
### in you workspace root must has a mock.json file:
for example:
```json
{
"/": "hello world!",
"api": {
"user": ["saber2pr", "nanasaki"],
"com": "com"
},
"other": "233"
}
```
the json data will be parsed to an array:
```js
;[
{ key: '/', value: 'hello world!' },
{ key: '/api/user', value: ['saber2pr', 'nanasaki'] },
{ key: '/api/com', value: 'com' },
{ key: '/other', value: '233' }
]
```
then config to server :)
---
## start
```bash
npm install
```
```bash
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!