There are few good practices one can follow while starting a node app / project.
1. One of them, I learned today, is that it's a good practice to have a package.json file which keeps info related to app and dependencies. You can do so using the below command:
$ npm init
It will ask for a couple of questions. You can click enter to skip them and use the default values instead.
After you are done, you can see a "package.json" file created in your current directory. You might want to edit package.json file and add "private" property to the json list as below to prevent the json being published to npm.
"private" : false
2. The above step will basically help us and others, who are added to work on the project, setup the project initially to get a brief idea about the app and its dependencies and also they can install the related dependencies listed in it using the below command:
$ npm install
It helps in installing the version used in the app instead of the latest. That's important since there might be api changes to the package and it might not be working with the current app setup.
3. Another practice one can follow is to save the version to the package.json when you install any package. You can do so by using the "--save" option with "npm install" command. For example:
$ npm install express --save
The above command will save "express" as a dependency with the installed version mentioned.
This has helped me a lot and is quite interesting :)
1. One of them, I learned today, is that it's a good practice to have a package.json file which keeps info related to app and dependencies. You can do so using the below command:
$ npm init
It will ask for a couple of questions. You can click enter to skip them and use the default values instead.
After you are done, you can see a "package.json" file created in your current directory. You might want to edit package.json file and add "private" property to the json list as below to prevent the json being published to npm.
"private" : false
2. The above step will basically help us and others, who are added to work on the project, setup the project initially to get a brief idea about the app and its dependencies and also they can install the related dependencies listed in it using the below command:
$ npm install
It helps in installing the version used in the app instead of the latest. That's important since there might be api changes to the package and it might not be working with the current app setup.
3. Another practice one can follow is to save the version to the package.json when you install any package. You can do so by using the "--save" option with "npm install" command. For example:
$ npm install express --save
The above command will save "express" as a dependency with the installed version mentioned.
This has helped me a lot and is quite interesting :)