This article explains how to set up an angular js project using node.js.
To set up your angular js project using node js, make sure node js is installed on your system with other required components like ruby, python, git etc. These components can be installed as per your project requirement. You also need an IDE like WebStorm, Visual Studio Code to start your development.
Follow below steps to set up your first angular js application:
1) Create a folder and double click on it. Right click on blank area pressing shift key. A popup will show up. Click on Open command window here. You can simply click on navaigation bar and write "cmd" to open command window.
2) A command window will open with a path of your project. Write npm init command and press enter.
3) Command will start creating package.json file which contains project details and its dependencies information.
4) You will be walk through an utility. This utility also has default values. Enter desired values or left blank to use default entries. Press enter when needed.
5) At the end of the utility, it will preview the package.json file created so far. Press enter if you are done or start again.
6) You will find a package.json file is created in your application folder.
7) Now it is the time to add dependencies to package.json file. Write npm install DependencyName --save command to add dependencies and save it to package.json file i.e. npm install angular --save to install angular js dependency. You can add particular version using command npm install DependencyName@version --save i.e. npm install firstname.lastname@example.org --save.
You can add angular ui router dependency as npm install angular-ui-router --save.
8) This is your package.json after adding angular dependency. You can add other dependencies also as per your requirement like "angular-route", "angular-message" etc.
9) Once you installed all your dependencies through npm command, now it is turn to add bower component to your application. You can install bower component using bower init command.
10) This command will generate bower.json file which contains your project related dependencies.
package.json and bower.json are the part of node which contains dependencies and other information about your project. You should add your custom dependencies in bower.json file and dependencies like angular, ui-router in package.json file.
Hope it helps you. Please be connected for more articles.