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

请问 怎么把 eggjs 的npm run start 加入到 系统服务 #9

Open
mei2015 opened this issue Apr 18, 2019 · 12 comments
Open

请问 怎么把 eggjs 的npm run start 加入到 系统服务 #9

mei2015 opened this issue Apr 18, 2019 · 12 comments

Comments

@mei2015
Copy link

mei2015 commented Apr 18, 2019

请问 怎么把 eggjs 的npm run start 加入到 系统服务

@atian25
Copy link

atian25 commented Apr 18, 2019

就是一个 shell,其他的该怎么加它就怎么加,没啥区别

@mei2015
Copy link
Author

mei2015 commented Apr 18, 2019

我用的 node-window 但是。。

@mei2015
Copy link
Author

mei2015 commented Apr 18, 2019

[图片]这个 地方的 script 怎么配置啊

@mei2015
Copy link
Author

mei2015 commented Apr 18, 2019

@atian25
Copy link

atian25 commented Apr 18, 2019

直接指向 node_modules/.bin/egg-scripts 或者自己写个 js 来 fork npm start

@mei2015
Copy link
Author

mei2015 commented Apr 18, 2019

他是这样的 start: egg-script ...
主要是node-windows script 怎么写啊

@mei2015
Copy link
Author

mei2015 commented Apr 18, 2019

直接指向 node_modules/.bin/egg-scripts 或者自己写个 js 来 fork npm start

大大 能给我 列子 不 刚接触 这块 不太明白 现在 要用

@chenshenhai
Copy link
Owner

@mei2015 您好,你提出的问题很有意思,我一开始在学习egg.js时候也是第一反应在找怎用npm run start去启动。

因为egg.js本身对启动脚本做了封装,所以从初始化的脚手架是看不出传统Node应用npm run start的逻辑。

这里我之前写过一个最小demo, https://github.com/chenshenhai/eggjs-note/blob/master/demo/002-complete/index.js 使用egg 的node_module 替换里面的lib/egg,就可以直接用npm run start使用egg.js的核心服务能力。

@chenshenhai
Copy link
Owner

@atian25 惊现天猪大大,哈哈,很惭愧没时间把这本开源书写完 o(╯□╰)o

@atian25
Copy link

atian25 commented Apr 22, 2019

不用那么复杂,就是写个 dispatch.js

// dispatch.js
const Command = require('egg-scripts');
new Command([
  'start', '--port=7001',
]).start();

@mei2015
Copy link
Author

mei2015 commented Apr 23, 2019

@mei2015 您好,你提出的问题很有意思,我一开始在学习egg.js时候也是第一反应在找怎用npm run start去启动。

因为egg.js本身对启动脚本做了封装,所以从初始化的脚手架是看不出传统Node应用npm run start的逻辑。

这里我之前写过一个最小demo, https://github.com/chenshenhai/eggjs-note/blob/master/demo/002-complete/index.js 使用egg 的node_module 替换里面的lib/egg,就可以直接用npm run start使用egg.js的核心服务能力。

这个我知道 我是像加入到系统服务器 我用node-window 解决的

@mei2015
Copy link
Author

mei2015 commented Apr 23, 2019

不用那么复杂,就是写个 dispatch.js

// dispatch.js
const Command = require('egg-scripts');
new Command([
  'start', '--port=7001',
]).start();

嗯 谢谢了 我解决了 还是用的 node-windows

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

3 participants