Skip to content

Commit

Permalink
Merge branch 'master' into feat/improve-doc
Browse files Browse the repository at this point in the history
  • Loading branch information
popomore authored Jun 26, 2017
2 parents 1208e74 + daa8227 commit bbd6d3c
Show file tree
Hide file tree
Showing 30 changed files with 1,120 additions and 69 deletions.
6 changes: 4 additions & 2 deletions .autod.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ module.exports = {
plugin: 'autod-egg',
prefix: '^',
devprefix: '^',
registry: 'https://r.cnpmjs.org',
exclude: [
'test/fixtures',
'examples',
Expand All @@ -22,7 +21,10 @@ module.exports = {
'egg-plugin-puml',
'egg-view-nunjucks',
],
keep: [
dep: [
'@types/accepts',
'@types/koa',
'@types/koa-router',
],
semver: [
'eslint@3',
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,6 @@ docs/**/contributing.md
docs/public
docs/plugins.png

package-lock.json
yarn.lock
!test/fixtures/apps/loader-plugin/node_modules
38 changes: 36 additions & 2 deletions History.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,48 @@
# History

## 2017-05-28, Version 1.3.1, @dead-horse
## 2017-06-21, Version 1.5.0, @fengmk2

* **feature**
* better TypeScript support, add `index.d.ts` file.
* enable overrideMethod middleware by default.
* **document**
* Documents improved.

### Commits

* [[`1d02601`](http://github.com/eggjs/egg/commit/1d026019df76525d2d9117c260eb5d892388121c)] - tsd: add another properties of FileStream (#1080) (Rwing <<[email protected]>>)
* [[`2b1644e`](http://github.com/eggjs/egg/commit/2b1644e6d56e6481ee97bce009c5f53b4dd18441)] - feat: add tsd (#1027) (Eward Song <<[email protected]>>)
* [[`a4ba2a2`](http://github.com/eggjs/egg/commit/a4ba2a2a1ef7de49e196c01447fd73ab22ed6d34)] - feat: enable overrideMethod middleware by default (#1069) (fengmk2 <<[email protected]>>)
* [[`bfb8df5`](http://github.com/eggjs/egg/commit/bfb8df58bcc7d7fe0fd6ff3453efcb54b715b4a0)] - docs: typo (#1060) (chenbin92 <<[email protected]>>)
* [[`64d1b00`](http://github.com/eggjs/egg/commit/64d1b0026648e1128f09efb6e6c2cc7f632bf608)] - docs: add chrome devtools debug information (#1050) (仙森 <<[email protected]>>)
* [[`4e510b2`](http://github.com/eggjs/egg/commit/4e510b22836096a47d562dbd5ca8affd28f94f9e)] - chore: use app.httpRequest() instead of supertest (#1041) (fengmk2 <<[email protected]>>)
* [[`78a13d5`](http://github.com/eggjs/egg/commit/78a13d52c3b6e8b40a0015b285cda33a059c0ee4)] - docs: add more description at quickstart (#1042) (TZ | 天猪 <<[email protected]>>)
* [[`ef7c864`](http://github.com/eggjs/egg/commit/ef7c864fbddf7e70afbd93a16d5176787328400d)] - docs: add ant.design link (#1037) (Haoliang Gao <<[email protected]>>)
* [[`f1b510c`](http://github.com/eggjs/egg/commit/f1b510c34039259c5772021432ab71a7a62b89e8)] - feat: add config.logger.disableConsoleAfterReady (#1001) (fengmk2 <<[email protected]>>)
* [[`4890eda`](http://github.com/eggjs/egg/commit/4890eda31b9bc60ea4a1a7f36460ec1bf86dc134)] - docs: Uniform the standards that we should acquire this parsed parame… (#1038) (Ruanyq <<[email protected]>>)
* [[`9d705e4`](http://github.com/eggjs/egg/commit/9d705e4687cdb98d327fbd9a1061604828218dfc)] - test: make sure app close (#1030) (fengmk2 <<[email protected]>>)
* [[`1d72e37`](http://github.com/eggjs/egg/commit/1d72e3799822e252934d6218a978c2bd21f378d3)] - docs: fix caseStyle link (#1033) (Desen Meng <<[email protected]>>)
* [[`9b50725`](http://github.com/eggjs/egg/commit/9b507250725ef3beda0ee51ac0c2bc2b007b2ecb)] - docs: (tutorials/index.md & async-function.md ): [translate] Done (#1028) (Darren Wong <<[email protected]>>)
* [[`3d04199`](http://github.com/eggjs/egg/commit/3d041992912d9aca1eb0edc6b226474022e08236)] - docs: typo (#1029) (Jerry Wu <<[email protected]>>)
* [[`13b7c19`](http://github.com/eggjs/egg/commit/13b7c19531d772a2b932ada28e186a0dbd0cf5f5)] - test: node 8 (#976) (fengmk2 <<[email protected]>>)
* [[`1b108a7`](http://github.com/eggjs/egg/commit/1b108a72a96d3d8241b332b8e728a9ec409efbb1)] - docs: remove api that is from egg-rest (#1022) (Haoliang Gao <<[email protected]>>)
* [[`057bc47`](http://github.com/eggjs/egg/commit/057bc47e4c5e3ec8faae0de3807f656fa4ef41d4)] - test: add doc test (#989) (Haoliang Gao <<[email protected]>>)
* [[`c6eb7b2`](http://github.com/eggjs/egg/commit/c6eb7b2f59f24fe0c6a787829d33cdf0cd4a2e77)] - doc: fix view config doc (#991) (当轩 <<[email protected]>>)
* [[`52865b4`](http://github.com/eggjs/egg/commit/52865b47c4d336833ef1151bae9f30867359ceb6)] - docs: devtool inspect at 8.x (#1018) (TZ | 天猪 <<[email protected]>>)
* [[`8a120fd`](http://github.com/eggjs/egg/commit/8a120fde73df60e23f8c5559a3281acaf0a393e0)] - docs: remove max time limit at schdule (#995) (TZ | 天猪 <<[email protected]>>)
* [[`9084c24`](http://github.com/eggjs/egg/commit/9084c24dd10fcbcd0d436ada9639b59f36dd2edf)] - docs: add plugin list (#988) (Haoliang Gao <<[email protected]>>)
* [[`20a5d91`](http://github.com/eggjs/egg/commit/20a5d9127f7454c899f7701f02b04eefa7c61fce)] - test: disable coverage for schedule (#987) (Haoliang Gao <<[email protected]>>)
* [[`3de963f`](http://github.com/eggjs/egg/commit/3de963f3881ef6fb9c5b6fa207730c6695853239)] - docs(basics/structure.md): [translate] (#970) (Weilun Xiong <<[email protected]>>)
* [[`2f232f3`](http://github.com/eggjs/egg/commit/2f232f30b0ba7e14ab07c43e34d363bac3906a43)] - docs: file must appear after other fiels when using getFileStream (#982) (Yiyu He <<[email protected]>>)

## 2017-05-28, Version 1.4.0, @dead-horse

* **feature**
* use lru to aovid oom when httpclient dns cache enabled
* **fix**
* fix port is missed when httpclient dns cache enabled
* fix request url object will be changed when httpclient dns cache enabled
* set maxSockets defautl value to Number.MAX_SAFE_INTEGER

* **document**
* Documents improved. Thanks @DarrenWong, @zousandian, @lslxdx, @Azard, @johnnychen, @coogleyao, @DanielWLam, @m31271n, @Brian175

Expand Down
3 changes: 3 additions & 0 deletions app/middleware/override_method.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
'use strict';

module.exports = require('koa-override');
19 changes: 10 additions & 9 deletions config/config.default.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ module.exports = appInfo => {
*
* @member {Object} Config#siteFile - key is path, and value is url or buffer.
* @example
* // 指定应用 favicon, => '/favicon.ico': 'https://eggjs.org/favicon.ico',
* // specific app's favicon, => '/favicon.ico': 'https://eggjs.org/favicon.ico',
* config.siteFile = {
* '/favicon.ico': 'https://eggjs.org/favicon.ico',
* };
Expand All @@ -168,16 +168,16 @@ module.exports = appInfo => {
* The option of `bodyParser` middleware
*
* @member Config#bodyParser
* @property {Boolean} enable - enable bodyParser or not, default to true
* @property {Boolean} enable - enable bodyParser or not, default is true
* @property {String | RegExp | Function | Array} ignore - won't parse request body when url path hit ignore pattern, can not set `ignore` when `match` presented
* @property {String | RegExp | Function | Array} match - will parse request body only when url path hit match pattern
* @property {String} encoding - body 的编码格式,默认为 utf8
* @property {String} formLimit - form body 的大小限制,默认为 100kb
* @property {String} jsonLimit - json body 的大小限制,默认为 100kb
* @property {Boolean} strict - json body 解析是否为严格模式,如果为严格模式则只接受 object 和 array
* @property {Number} queryString.arrayLimit - 表单元素数组长度限制,默认 100,否则会转换为 json 格式
* @property {Number} queryString.depth - json 数值深度限制,默认 5
* @property {Number} queryString.parameterLimit - 参数个数限制,默认 1000
* @property {String} encoding - body's encoding type,default is utf8
* @property {String} formLimit - limit of the urlencoded body. If the body ends up being larger than this limit, a 413 error code is returned. Default is 100kb
* @property {String} jsonLimit - limit of the json body, default is 100kb
* @property {Boolean} strict - when set to true, JSON parser will only accept arrays and objects. Default is true
* @property {Number} queryString.arrayLimit - urlencoded body array's max length, default is 100
* @property {Number} queryString.depth - urlencoded body object's max depth, default is 5
* @property {Number} queryString.parameterLimit - urlencoded body maximum parameters, default is 1000
*/
config.bodyParser = {
enable: true,
Expand Down Expand Up @@ -254,6 +254,7 @@ module.exports = appInfo => {
'siteFile',
'notfound',
'bodyParser',
'overrideMethod',
];

/**
Expand Down
1 change: 1 addition & 0 deletions docs/source/_data/links.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ Community:
Issues: https://github.com/eggjs/egg/issues
Links:
Ant Design: https://ant.design
Enclose.IO: http://enclose.io
12 changes: 11 additions & 1 deletion docs/source/en/basics/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@ module.exports = {
},
};
```

The configuration file can simplify to `exports.key = value` format

```js
exports.keys = 'my-cookie-secret-key';
exports.logger = {
level: 'DEBUG',
};
```

The configuration file can also return a function which could receive a parameter called `appInfo`

```js
Expand Down Expand Up @@ -75,7 +85,7 @@ Here is one sequence of loading configurations under "prod" environment, in whic
-> plugin config.prod.js
-> framework config.prod.js
-> application config.prod.js

**Note: there will be plugin loading sequence, but the approximate order is similar. For specific logic, please check the [loader](../advanced/loader.md) .**

### Merging rule
Expand Down
12 changes: 6 additions & 6 deletions docs/source/en/intro/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ Egg is a convention-over-configuration framework, follows the [Loader](../advanc

## features

- depth [customizd framework](../advanced/framework.md)
- highly extensible [plug-in mechanism](../advanced/plugin.md)
- built-in [cluster](../advanced/cluster-client.md)
- based on [koa] with high performance
- stable core framework with high test coverage.
- [progressive development](../tutorials/progressive.md)
- Provide capability to [customizd framework](../advanced/framework.md) base on Egg
- Highly extensible [plug-in mechanism](../advanced/plugin.md)
- Built-in [cluster](../advanced/cluster-client.md)
- Based on [Koa] with high performance
- Stable core framework with high test coverage
- [Progressive development](../tutorials/progressive.md)

[Sails]: http://sailsjs.com
[Express]: http://expressjs.com
Expand Down
27 changes: 11 additions & 16 deletions docs/source/en/intro/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,10 @@ module.exports = app => {
};
```

Then add a configuration file:
Then add a [configuration](../basics/config.md) file:

```js
// config/config.default.js
// should change to your own keys
exports.keys = <YOUR_SECURITY_COOKE_KEYS>;
```

Expand Down Expand Up @@ -174,18 +173,13 @@ exports.nunjucks = {

```js
// config/config.default.js
module.exports = appInfo => {
const config = {};
config.keys = <YOUR_SECURITY_COOKE_KEYS>;

// add config
config.view = {
defaultViewEngine: 'nunjucks',
mapping: {
'.tpl': 'nunjucks',
},
}
return config;
exports.keys = <YOUR_SECURITY_COOKE_KEYS>;
// add view's configurations
exports.view = {
defaultViewEngine: 'nunjucks',
mapping: {
'.tpl': 'nunjucks',
},
};
```

Expand Down Expand Up @@ -308,6 +302,7 @@ And also add config.

```js
// config/config.default.js
// add news' configurations
exports.news = {
pageSize: 5,
serverUrl: 'https://hacker-news.firebaseio.com/v0',
Expand Down Expand Up @@ -367,11 +362,11 @@ module.exports = (options, app) => {
};

// config/config.default.js
// mount middleware
// add middleware robot
exports.middleware = [
'robot'
];
// middleware config
// robot's configurations
exports.robot = {
ua: [
/Baiduspider/i,
Expand Down
9 changes: 9 additions & 0 deletions docs/source/zh-cn/basics/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@ module.exports = {
};
```

配置文件也可以简化的写成 `exports.key = value` 形式

```js
exports.keys = 'my-cookie-secret-key';
exports.logger = {
level: 'DEBUG',
};
```

配置文件也可以返回一个 function,可以接受 appInfo 参数

```js
Expand Down
6 changes: 3 additions & 3 deletions docs/source/zh-cn/core/cluster-and-ipc.md
Original file line number Diff line number Diff line change
Expand Up @@ -284,14 +284,14 @@ if (cluster.isMaster) {

- `app.messenger.broadcast(action, data)`:发送给所有的 agent / app 进程(包括自己)
- `app.messenger.sendToApp(action, data)`: 发送给所有的 app 进程
- 在 app 调用该方法上会发送给自己和其他的 app 进程
- 在 app 上调用该方法会发送给自己和其他的 app 进程
- 在 agent 上调用该方法会发送给所有的 app 进程
- `app.messenger.sendToAgent(action, data)`: 发送给 agent 进程
- 在 app 调用该方法上会发送 agent 进程
- 在 app 上调用该方法会发送给 agent 进程
- 在 agent 上调用该方法会发送给 agent 自己
- `agent.messenger.sendRandom(action, data)`:
- app 上没有该方法(现在 Egg 的实现是等同于 sentToAgent)
- agent 上回随机发送消息给一个 app 进程(由 master 来控制发送给谁)
- agent 会随机发送消息给一个 app 进程(由 master 来控制发送给谁)
- `app.messenger.sendTo(pid, action, data)`: 发送给指定进程

```js
Expand Down
2 changes: 1 addition & 1 deletion docs/source/zh-cn/intro/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Egg 奉行『**约定优于配置**』,按照[一套统一的约定](../advanc

## 特性

- 深度[框架定制](../advanced/framework.md)
- 提供基于 Egg [定制上层框架](../advanced/framework.md)的能力
- 高度可扩展的[插件机制](../advanced/plugin.md)
- 内置[多进程管理](../advanced/cluster-client.md)
- 基于 [Koa] 开发,性能优异
Expand Down
27 changes: 11 additions & 16 deletions docs/source/zh-cn/intro/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,10 @@ module.exports = app => {
};
```

加一个配置文件
加一个[配置文件](../basics/config.md)

```js
// config/config.default.js
// 切记:要改为自己的 key 值
exports.keys = <此处改为你自己的 Cookie 安全字符串>;
```

Expand Down Expand Up @@ -162,18 +161,13 @@ exports.nunjucks = {

```js
// config/config.default.js
module.exports = appInfo => {
const config = {};
config.keys = <此处改为你自己的 Cookie 安全字符串>;

// 添加配置
config.view = {
defaultViewEngine: 'nunjucks',
mapping: {
'.tpl': 'nunjucks',
},
}
return config;
exports.keys = <此处改为你自己的 Cookie 安全字符串>;
// 添加 view 配置
exports.view = {
defaultViewEngine: 'nunjucks',
mapping: {
'.tpl': 'nunjucks',
},
};
```

Expand Down Expand Up @@ -289,6 +283,7 @@ module.exports = app => {

```js
// config/config.default.js
// 添加 news 的配置项
exports.news = {
pageSize: 5,
serverUrl: 'https://hacker-news.firebaseio.com/v0',
Expand Down Expand Up @@ -341,11 +336,11 @@ module.exports = (options, app) => {
};

// config/config.default.js
// mount middleware
// add middleware robot
exports.middleware = [
'robot'
];
// middleware config
// robot's configurations
exports.robot = {
ua: [
/Baiduspider/i,
Expand Down
Loading

0 comments on commit bbd6d3c

Please sign in to comment.