-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: modify and fix 3 points #264
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,7 @@ $ npm i | |
|
||
```bash | ||
$ npm run dev | ||
$ open localhost:7001 | ||
$ open localhost:7001/home | ||
``` | ||
|
||
## 逐步搭建 | ||
|
@@ -196,9 +196,9 @@ module.exports = app => { | |
// parallel GET detail, see `yield {}` from co | ||
const newsList = yield Object.keys(idList).map(key => { | ||
const url = `${serverUrl}/item/${idList[key]}.json`; | ||
return this.ctx.curl(url, { dataType: 'json' }).then(res => res.data); | ||
return this.ctx.curl(url, { dataType: 'json' }); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @atian25 叫你不写单测。。。 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. -.-!!
内网版之前这么写的, 我就随手简化了下... examples 那边没问题的. |
||
}); | ||
return newsList; | ||
return newsList.map(res => res.data); | ||
} | ||
} | ||
return NewsService; | ||
|
@@ -217,6 +217,15 @@ exports.list = function* newsList() { | |
yield this.render('news/list.tpl', { list: newsList }); | ||
}; | ||
``` | ||
还需增加app/service/news.js中读取到的配置: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 文件路径加上代码块,还有空格 |
||
|
||
```js | ||
// config/config.default.js | ||
config.news = { | ||
pageSize: 5, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这里缩进错了 |
||
serverUrl: 'https://hacker-news.firebaseio.com/v0', | ||
}; | ||
``` | ||
|
||
### 编写扩展 | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个地方不用改 home 了, boilerplate 那边我发 PR 修改了.
https://github.com/eggjs/egg-boilerplate-simple/pull/19/files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
麻烦再改改, 然后可以合并了