0.2.3 • Published 8 years ago

biz-server v0.2.3

Weekly downloads
3
License
MIT
Repository
github
Last release
8 years ago

biz-server: http server and mock

NPM version NPM downloads total NPM license Build Status Dependency Status devDependency Status bitHound Overalll Score

biz-server是一个命令行http server,并包含了一个mock center。

NPM Stat

安装

npm install biz-server -g 

请全局安装biz-server,并使用命令行操作

使用

http server功能

biz-server [path] [options]

or

bs [path] [options]

path:如果没有指定path,那么则认为是当前目录,推荐不指定path,使用当前目录 options:biz-server的http功能是基于https://github.com/indexzero/http-server实现的,能够接受所有http-server的参数

-p Port to use (defaults to 8080)

-a Address to use (defaults to 0.0.0.0)

-d Show directory listings (defaults to 'True')

-i Display autoIndex (defaults to 'True')

--as be filterd ajax request suffix, comma separated (defaults to '.action')

-m or --mock mock config path (defaults to cwd() + /config/mockConfig])

-e or --ext Default file extension if none supplied (defaults to 'html')

-s or --silent Suppress log messages from output

--cors Enable CORS via the Access-Control-Allow-Origin header

-o Open browser window after starting the server

-c Set cache time (in seconds) for cache-control max-age header, e.g. -c10 for 10 seconds (defaults to '3600'). To disable caching, use -c-1.

-U or --utc Use UTC time format in log messages.

-P or --proxy Proxies all requests which can't be resolved locally to the given url. e.g.: -P http://someurl.com

-S or --ssl Enable https.

-C or --cert Path to ssl cert file (default: cert.pem).

-K or --key Path to ssl key file (default: key.pem).

-r or --robots Provide a /robots.txt (whose content defaults to 'User-agent: *\nDisallow: /')

-h or --help Print this list and exit.

-v or --version Print the version.

mock功能

step1:

cd path

进入到希望biz-server运行的目录

step2:

biz-server --init mock

初始化mock功能

step3:

在启动时,增加mock参数,指定mock功能的配置文件

-m your config path  [cwd() + /config/mockConfig]

mock配置文件如下:

{
    "dataSource": ["template", "json"],
    "json": {
	    "path": "/mock/data/",
	    "wrap": false
    },
    "template": {
    	"path": "/mock/template/"
    }
}

mock配置文件请参考biz-mock

https://github.com/yanyu0517/biz-mock#mockconfig

demo

https://github.com/yanyu0517/biz-server/tree/gh-pages

0.2.3

8 years ago

0.2.2

9 years ago

0.2.1

9 years ago

0.2.0

9 years ago

0.1.9

10 years ago

0.1.8

10 years ago

0.1.7

10 years ago

0.1.6

10 years ago

0.1.5

10 years ago

0.1.4

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago