-
Notifications
You must be signed in to change notification settings - Fork 0
Usage
akihito edited this page May 11, 2014
·
13 revisions
$ git clone git@github.com:takihito/Web-API-Mock.git
$ cpanm ./Web-API-Mock
:
$ run-api-mock --help
Usage:
$ run-api-mock --files api.md --not-implemented-urls url.txt --port 8080
# api.md
## GET /hello
+ Response 200 (text/plain)
Hello World
$ run-api-mock --files api.md HTTP::Server::PSGI: Accepting connections at http://0:5000
- files
- API Document Files.
$ run-api-mock --files api1.md --files api2.md
- not-implemented-urls
- Add "501 Not Implemented" info (Method and URL).
GET,/hello/hoge POST,/hello/foo
-
port
-
server port
-
Other...
-
plackup options
By using nginx
see not-implemented-urls option.
$ run-api-mock --files api.md --not-implemented-urls url.txt --port 5001
upstream mock_backend {
server 127.0.0.1:5001;
}
upstream prod_backend {
server 127.0.0.1:5002;
}
server {
:
:
location ~ ^/ {
proxy_intercept_errors on;
proxy_pass http://mock_backend;
proxy_set_header Host $host;
}
error_page 501 =200 @prod;
location @prod {
proxy_pass http://prod_backend;
proxy_set_header Host $host;
}