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

API #139

Open
jonathanong opened this issue Jun 26, 2016 · 5 comments
Open

API #139

jonathanong opened this issue Jun 26, 2016 · 5 comments

Comments

@jonathanong
Copy link

would be nice if there were an API. i'd like to embed a server within a server and have the sub app automatically restart itself

@fgnass
Copy link
Owner

fgnass commented Jun 29, 2016

It's undocumented, but you can already do the following:

const nodeDev = require('node-dev');
nodeDev(script, scriptArgs, nodeArgs, opts);

Would this work for you?

@jonathanong
Copy link
Author

jonathanong commented Jun 29, 2016

yep, i just don't know what those arguments are :P all i need are docs or comments!

@fgnass
Copy link
Owner

fgnass commented Jun 29, 2016

nodeDev(
  '/some/script.js', // the script to run
  ['--foo', '-bar'], // command line arguments to pass to the script
  ['--debug'],       // arguments to pass to the node binary
  {
    notify: false,   // whether to use desktop notifications
    deps: true,      // whether to watch files in node_modules too
    allDeps: false,  // whether to watch transitive deps (deps of deps) too
    dedupe: false,   // whether to use https://github.com/thlorenz/dynamic-dedupe
    respawn: false,  // whether to keep watching for changes after the script has exited
    poll: false,     // whether to force polling for file changes
  }
);

@Sawtaytoes
Copy link

Are those the defaults you listed?

@chhpt
Copy link

chhpt commented Mar 11, 2021

@fgnass hi, if i use nodeDev(script, scriptArgs, nodeArgs, opts);, could I got some callback event when code restart?

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

4 participants