Skip to content
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

几点建议 #1

Closed
atian25 opened this issue Apr 26, 2017 · 1 comment
Closed

几点建议 #1

atian25 opened this issue Apr 26, 2017 · 1 comment

Comments

@atian25
Copy link

atian25 commented Apr 26, 2017

非常赞,感谢回馈。

以下是几点建议:

  • 配置修改exports['oauth2-server'] 改为 exports.oauth2Server
  exports.oauth2Server = {
    debug: process.env.NODE_ENV !== 'production',
    grants: [ 'password' ],
    model: oauth_model(app),
  };
  • 插件也修改为
exports.oauth2Server = {
  enable: true,
  package: 'egg-oauth2-server',
};
  • model 不用用户手动初始化,通过 Loader API 自动加载,可以参考 egg-sequelizeegg-view-nunjucks 的实现

  • app.js 里面的 console.log 可以改为 app.coreLogger,参见 日志

  • debug: process.env.NODE_ENV !== 'production' 可以考虑直接读取 app.config.env === 'local' 做转换

  • agent.js 没用可以去掉

  • index.js 也是多余的,你是用了 simple 那个 boilerplate ?应该用 plugin 那个,建议用 egg-boilerplate-plugin 重新初始化下,现在看到有不少不需要的代码,如 package.json 的 scripts 等。

@Azard
Copy link
Owner

Azard commented Apr 26, 2017

感谢指导,我也正在学习 egg 的写法,egg 标准化定好确实适合多人开发。

@Azard Azard closed this as completed Apr 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants