We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
名称:mokia 地址:https://github.com/varHarrie/mokia 描述:通过编写代码方式构建假模型,用于生成假数据,便于前端mock接口测试,假模型可以很方便在不同接口中复用。 特点:
假模型
假数据
使用方法: 1.安装npm install mokia --save-dev
npm install mokia --save-dev
import { decorators, mock, PORT, ServerConfig } from 'mokia' class User { decorators.uuid() id: string decorators.fullName() name: string } const config: ServerConfig = { [PORT]: 3000, 'GET /users': () => { return { users: mock.array(User, 0, 5) } }, 'GET /users/:id': () => { return mock(User) } } export default config
2.配置scripts:
scripts
"scripts": { "mock": "mokia mock.ts", }
3.运行
npm run mock
4.浏览器打开http://localhost:3000/users/5,返回json:
http://localhost:3000/users/5
{ "id": "4fvke82k", "name": "张三" }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
名称:mokia
地址:https://github.com/varHarrie/mokia
描述:通过编写代码方式构建
假模型
,用于生成假数据
,便于前端mock接口测试,假模型
可以很方便在不同接口中复用。特点:
使用方法:
1.安装
npm install mokia --save-dev
2.配置
scripts
:3.运行
4.浏览器打开
http://localhost:3000/users/5
,返回json:The text was updated successfully, but these errors were encountered: