[ad_1]
Deploying Node.js
applications is very easy stuff. In maven, there is pom.xml
. Related concept in Node.js
is package.json
. You can state your dependencies on package.json
. You can also do environmental setup on package.json
. For example, in dev environment you can say that
I want to run unit tests.
but in production;
I want to skip unit tests.
You have local repositories for maven under .m2
folder. In Node.js, there is node_modules
folder under your Node.js project. You can see module folders with its name.
Let’s come to the grunt
part of this answer. Grunt
is a task manager for your frontend assets, html, javascript, css. For example, before deployment you can minify html, css, javascript even images. You can also put grunt
task run functions in package.json
.
If you want to look at a sample application, you can find an example blog application here. Check folder structure and package.json
for reference.
For deployment, I suggest you heroku deployment for startup applciations. You can find howto here. This is simple git based deployment.
On project running part, simply set your environment NODE_ENV=development
and node app.js
. Here app.js
is in your project.
Here is relative concept for java and nodejs;
maven clean install
=>npm install
.m2
folder =>node_modules
(Under project folder)mvn test
=>npm test
(test section onpackage.json
)junit
,powermock
, … => mocha, node-unit, …Spring MVC
=> Express.JSpom.xml
=>package.json
import package
=>require('module_name')
[ad_2]