If you are working on your local computer and you are working with the MEAN Stack (MongoDB, Express, AngularJS and NodeJS), each time you start your project you will need to open three command prompts and type in commands to get the Node server and MongoDB server running. There is an easier and faster way.
Suppose you are working with the YouTube video tutorial called MEAN Stack RESTful API Tutorial Using MongoDB, Express, Angular JS, and Node JS Together by Learn Coding Tutorials as I am right now, or suppose you are just working locally with the MEAN Stack and you are looking for a fast way to start your servers, consider using the following batch file.
To use this batch file you will need to change the directories to suit how you have installed your servers (which undoubtedly will be different).
start cmd.exe /k "cd C:\Data\Portfolio\Websites\MEAN\contactlistapp && node server" start cmd.exe /k "cd C:\Program Files\MongoDB\Server\3.2\bin && mongod" TIMEOUT /T 5 /NOBREAK start cmd.exe /k "cd C:\Program Files\MongoDB\Server\3.2\bin && mongo"
To create this file, open a text editor, copy in this code and edit it to suit your setup, save the file by giving it a name and be sure to use a bat file extension. You can save it to your Desktop or some other convenient location. To run it, simply run it as you would any other program, by double-clicking the icon of file. Here is a post on this site that introduces you to the command line.
The /k keeps the command prompt running persistently without closing. The && allows you to run another command at the command prompt. We are running node server, mongod and mongo each in their own command environment.