Skip to content

Commit

Permalink
docs: Uniform the standards that we should acquire this parsed parame… (
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryqsky authored and popomore committed Jun 12, 2017
1 parent 9d705e4 commit 4890eda
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions docs/source/en/basics/router.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ module.exports = app => {

// app/controller/search.js
module.exports = function* (ctx) {
ctx.body = `search: ${this.query.name}`;
ctx.body = `search: ${ctx.query.name}`;
};

// curl http://127.0.0.1:7001/search?name=egg
Expand Down Expand Up @@ -265,9 +265,9 @@ module.exports = app => {
};

// app/controller/search.js
module.exports = function* () {
const type = this.query.type;
const q = this.query.q || 'nodejs';
module.exports = function* (ctx) {
const type = ctx.query.type;
const q = ctx.query.q || 'nodejs';

if (type === 'bing') {
this.redirect(`http://cn.bing.com/search?q=${q}`);
Expand All @@ -288,7 +288,7 @@ Here we just briefly explain how to use the middleware, and refer to [Middleware
```js
// app/controller/search.js
module.exports = function* (ctx) {
ctx.body = `search: ${this.query.name}`;
ctx.body = `search: ${ctx.query.name}`;
};

// app/middleware/uppercase.js
Expand Down
10 changes: 5 additions & 5 deletions docs/source/zh-cn/basics/router.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ module.exports = app => {

// app/controller/search.js
module.exports = function* (ctx) {
ctx.body = `search: ${this.query.name}`;
ctx.body = `search: ${ctx.query.name}`;
};

// curl http://127.0.0.1:7001/search?name=egg
Expand Down Expand Up @@ -270,9 +270,9 @@ module.exports = app => {
};

// app/controller/search.js
module.exports = function* () {
const type = this.query.type;
const q = this.query.q || 'nodejs';
module.exports = function* (ctx) {
const type = ctx.query.type;
const q = ctx.query.q || 'nodejs';

if (type === 'bing') {
this.redirect(`http://cn.bing.com/search?q=${q}`);
Expand All @@ -293,7 +293,7 @@ module.exports = function* () {
```js
// app/controller/search.js
module.exports = function* (ctx) {
ctx.body = `search: ${this.query.name}`;
ctx.body = `search: ${ctx.query.name}`;
};

// app/middleware/uppercase.js
Expand Down

0 comments on commit 4890eda

Please sign in to comment.