Reputation: 1164
I packaged my electron app. When I start my electron app, I want my MongoDB service to start automatically on the system installed locally. How can I achieve this through my node code?
Upvotes: 5
Views: 1594
Reputation: 321
hope this help you.
spawn = require("child_process").spawn,
mongo_server = spawn("mongod.exe", ["c:/mongo_path"], { cwd: process.cwd() })
Upvotes: 3
Reputation: 1178
If you installed MongoDB with agt-get (or ony similar manager), probably it will start automatically on systems boot. I haven used electron, but if it is possible to use node modules, you can do child_process.exec on your project startup.
Upvotes: 3