mercredi 25 février 2015

How to boot MongoDB, NodeJS and Express Server from Windows .bat file

I want to automate the launching of my local MEAN stack development env on a Windows 7 machine without having to manually launch my Mongo database, Node environment and express server. I want the .bat file to open a window, launch the resource and then remain open.


Here is the .bat file I've created in the root of the web project directory:



start cmd \k start "[PATH]\mongodb\bin\mongod.exe --dbpath [PATH]\mongodb\bin\data"

start cmd \k call "C:\Program Files\nodejs\nodevars.bat"

start cmd
cd ./public_html
node app.js


When I try to run this I get about 5 command prompt windows open but nothing ends up running except NodeJS. Appreciate any help or thoughts on getting this streamlined and automated.


Aucun commentaire:

Enregistrer un commentaire