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

可否支持类似于rails console那样的功能 #2064

Closed
Julyyq opened this issue Jan 31, 2018 · 2 comments

Comments

Projects
None yet
3 participants
@Julyyq
Copy link

commented Jan 31, 2018

比如命令行输入npm run console,就能自动进入到应用的环境中去。

可能的实现:

if (process.argv[2] && process.argv[2] == 'console') {
  const repl = require('repl');
  global.models = models;
  repl.start({
    prompt: '> ',
    useGlobal: true
  }).on('exit', () => { process.exit(); });
}
else {
  app.listen(config.port);
}
@atian25

This comment has been minimized.

Copy link
Member

commented Feb 1, 2018

related: #161

@atian25

This comment has been minimized.

Copy link
Member

commented Feb 1, 2018

简单写了个示例:

atian25/egg-showcase#7

有兴趣的可以写个插件完善下。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.