I am using the actionhero framework, it can be started by command actionhero start
. but the problem is that, my cloud node.js app runner can only run an app by specify a main file, such as index.js. How can I adapt my app to be started by a normal node.js file?
Asked
Active
Viewed 84 times
0

Yao Zhao
- 4,373
- 4
- 22
- 30
2 Answers
1
You have two choices
Choice #1
You can use child_process
to execute any shell from your node.js application. See this How can I invoke Ruby from Node.js? as a reference. This method is a native node.js way. You don't need to install any external npm.
Choice #2
Use shelljs
to execute such command. (https://github.com/arturadib/shelljs) The way it allows you execute the command is quite similar to using child_process
but it makes your code a little neater.
0
You're looking at something like...
'use strict';
let child_process = require('child_process');
child_process.execFile('node', [`.\path\to\actionhero`, `start`], (err) => {
if(err) console.log(err);
});

ByteHamster
- 4,884
- 9
- 38
- 53

Prometheus
- 61
- 7