Comments (14)
@vanpipy thx! Released [email protected]
from mocker-api.
@vanpipy I don't know what you are going to do.
from mocker-api.
Because the implementation is:
Like this
- mocker mock/index.js
+ mocker --config mocker.config.json mock/index.js // or
+ mocker mock/inde.js // search the mocker.config.json in the project defaulty
And the user can set the HOST
and PORT
as wish.
Is that necessary?
from mocker-api.
@vanpipy Support mocker mock/m1.js test/m2.js
from mocker-api.
@vanpipy Upgrade + [email protected]
from mocker-api.
Hi, @jaywcjlove ,
I got your idea, the next PR will upgrade the version and the document together.
from mocker-api.
@vanpipy Already supported.
- Support command line multi-file listeners 2c4dd5c
from mocker-api.
@vanpipy Support setting configuration on package.json?
{
...
"mocker": {
"host": "127.0.0.1",
"port": 7788
}
}
from mocker-api.
@vanpipy Support setting configuration on package.json?
{ ... "mocker": { "host": "127.0.0.1", "port": 7788 } }
That is a better choice :D.
And a result needs to figure out which one is the first config for the user.
I suggest the priority:
- from the command line.
- from the
package.json
. - from the
mocker.config.json
.
from mocker-api.
@vanpipy Support setting parameters:
mocker mock/index.js --port 7788
mocker mock/index.js --host 0.0.0.0
help:
Usage: mocker <path> [--config] [--help|h]
Displays help information.
Options:
--config <path> Simple configuration
Example:
mocker mock/index.js
mocker mock/index.js --port 7788
mocker mock/index.js --host 0.0.0.0
mocker mock/m1.js test/m2.js
mocker mock/m1.js --config mocker.config.json
from mocker-api.
Hi, @jaywcjlove ,
Yes, --host
and --port
is useful, and the usage needed.
from mocker-api.
Hi @vanpipy
I hope to help improve the documentation when I have time, thank you!
Command line supports more parameter configuration:
{
...
"mocker": {
"host": "127.0.0.1",
"port": 7788,
"pathRewrite": {
"^/api/repos/": "/repos/"
},
"changeHost": true,
...
}
}
from mocker-api.
Summary:
The mocker command line support 3 parameters:
--host localhost
--port 8000
--config ./mocker.config.json
Of course, the -h
and --help
is in the house already.
And the priority of the config - assuming three configurations exist already.
- Local mocker config like
mocker.config.json
. - The config in the
package.json
like:
{
"mocker": { ... }
}
- The parameters from the command line.
First, the mocker commander will try to find the mocker.config.json
. If exists and overwrite the default config.
Second, try to take the mocker
from package.json
. If exists and overwrite again.
Third, try to take host
and port
from the command line and overwrite the host and port.
That is all things of the mocker command line doing.
from mocker-api.
The issue resolved, so close it.
from mocker-api.
Related Issues (20)
- 更改mock文件,提示编译成功,但是浏览器报错404 HOT 2
- The MockerProxyRoute type does not work for strictNullChecks HOT 7
- Unable to use mocker-api in commonjs with type-checking enabled HOT 8
- Advice: give a quick start by the `npx mocker-ap` after `npm install mocker-api` HOT 1
- 之前一直在用2.0.4版,之前配置了proxy, 如果有配置mocker的路径就走mock,没有就走代理的特性没有了 HOT 13
- [Advice] Add issue template HOT 5
- Types declaration files are not release package HOT 2
- does it support Mock grammar? HOT 5
- 升级 Webpack 5 实例与 typedoc 冲突报错 HOT 1
- Action Required: Fix Renovate Configuration HOT 1
- Feature: Add option for additional files/folders to be watched
- Feature: support for vite2.0 HOT 2
- add setupProxy to src, throw error: Cannot use import statement outside a module
- Dependency Dashboard
- Feature: 怎么统一给代理的请求添加前缀 HOT 3
- Bug: delay undefined HOT 3
- Feature: Response patching
- 怎么使用 application/json 类型的解析器 HOT 6
- Feature: 能否支持一下vite配置呢? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mocker-api.