0

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?

2 Answers 2

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.

Sign up to request clarification or add additional context in comments.

Comments

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);
});

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.