Understanding Node.Js Project Structure in Visual Studio
Let’s create a new project in visual studio using Blank Node.js Console application template
Node.js is modular i.e. you have lots of modules contributed by open source community which aid in faster development.
Let’s try to understand the project structure:
NPM:
This works just like references if you have already worked on visual studio. This project used other node.js modules for various functionalities it might require.
Bower: Used for dependency management.
Grunt: JavaScript task runner. Helps in build automation, JavaScript minification etc
Jasmine : framework for writing unit test cases
Karma : JavaScript Test Runner. It Works with Jasmine and other testing frameworks.
Node-Gyp : node-gyp is a cross-platform command-line tool written in Node.js for compiling native addon modules for Node.js
style="display:block; text-align:center;"
data-ad-format="fluid"
data-ad-layout="in-article"
data-ad-client="ca-pub-5021110436373536"
data-ad-slot="9215486331">
App.js:
Again comparing with visual studio it’s the startup JavaScript file .When project runs this file is executed. You can change the startup file if you have multiple JavaScript files in project as below
Package.json:
This file contains information about the package. Again comparing with visual studio its similar to a combination of packages.config + assemblyinfo.cs
We can set name of package, version of package, author information and other dependent modules which our project will be using for various functionalities.