I am starting to use NodeJs. I am currently using Express to render a view, and I want to set some conventions.
My development environment uses NodeMon and Reload to automatically refresh the browser every time I make changes to the source code. I installed my dependencies as follows:
{
"scripts": {
"start": "nodemon app.js"
},
"dependencies": {
"express": "3.4.8",
"ejs-locals": "1.0.2",
"ejs": "*"
},
"devDependencies": {
"nodemon": "1.0.14",
"grunt": "*",
"grunt-contrib-less": "~0.9.0",
"grunt-contrib-cssmin": "~0.7.0",
"reload": "~0.1.0"
}
}
This ensures that my production environment does not load anything that is not really needed to run the application.
Reboot uses the javascript file located in /reload/reload.jsto update the browser. This file is added to my main layout.ejs file, so it runs in all views.
I am trying to do something like this so that it does not appear on the production server:
<%if (process.env.NODE_ENV === 'development') { %>
<script src="/reload/reload.js"></script>
<% } %>