The NodeJS installer
October 4, 2017
How to use it
To use this template you only have to select the option "NodeJS" in the first selection that displays when you start a new application. Next, you will have to select the URL from where you want to access your project. For example: gorilla.local, gorillajs.com, tuweb.org, etc. As GorillaJS has an Express.js installation by default, the next thing we are going to see is a blank page in our browser with a welcome text:
Another Express.js site built with GorillaJS!
Keep in mind that depending on how you are running GorillaJS, it’s possible that you have to enter your administrator password to be able to complete the installation.
The most important, is the package.json file. The app folder has the files for the application NodeJS that we are going to program. By default, there is an index.js file with a few lines of code that help initialize the Express.js server.
Like I stated in the beginning, we can delete all that code and use the application any way we want. The only condition is that the entry point continues to be the index.js file, since GorillaJS uses Forever to start the application and it points to the file. It’s also important to know that GorillaJS will restart the server automatically each time we make a change in any of the app folder files, so you can see the changes without having to restart it manually. The other important folder is the public, and that’s where the web goes. What’s left over is the package.json file, which is where we can install the necessary packets for the application. GorillaJS executes this file each time we start the project.
GorillaJS saves all the NodeJS server’s logs in the log folder. They are divided into three files: all_logs.txt saves all log history, errors.txt saves server errors and output.txt saves the server’s exit session. I use the command tail (Mac y Linux) when I want to see the server’s exit in real time.
$ tail -f logs/output.txt