Hot module reloading
Â
JavaScript is coded as an interpreted language. This means that it is not compiled in advance like RPG, C++, or Java. The source code file and the executable file are one and the same.Â
Whenever Node.js modules are used, however, Node automatically caches them for performance. When a module is cached, it doesn't have to be read from disk again and reinterpreted.
With traditional Node.js applications, cached modules are not reloaded until the node process is restarted. This means a server instance would have to be ended and started up again in order to incorporate changes to your applications.
To avoid downtime, Profound.js incorporates hot module reloading, a feature that invalidates the module cache immediately after a Profound.js module is modified. With this, you can deploy application changes instantly without having to restart Profound.js. Hot module reloading is enabled by default. To disable this feature, update the hotReloading flag in the Profound.js Configuration File.
Reloading API files and Workspaces
This following routes were added in version 6.0.0 of Profound.js.
For API files and Workspaces, they are automatically hot reloaded when they are saved in the IDE. However, if they are updated outside of the IDE they will not hot reload.Â
To reload these files without needing to open and then save them in the IDE, we added two routes that can be accessed via a POST webservice call to reload these files. The routes are /reloadAPI and /reloadWorkspaces:
 /reloadAPI will reload all API files not located in Workspaces
 /reloadWorkspaces will reload all files in Workspaces, including API files.
Â
Note: a workspace is a folder in the modules/ directory that has a hidden, .noderun/
directory and inside there, a settings.json
file containing at least the following:
{
"description": "",
"current git repository": "",
"git repositories": [""],
}
Therefore, if developers are copying Workspace files between different installations of Profound.js, then the .noderun/
directory and the settings.json
file also must be copied. Without the .noderun/settings.json
file, Profound.js does not consider a folder as a Workspace even if files were originally copied from a Workspace. Consequently, /reloadWorkspaces
would not detect new APIs in that folder because the folder is not a Workspace.
Â
Request Parameters and Security
Both of these routes take a POST request with no parameters, and are protected with basic authentication. Both routes respond with a simple {"success": true} object, regardless if any API files or Workspaces were updated or not.Â
To setup the basic authentication the server must use the basicAuthCredentials config option to store the credentials, and only these credentials will satisfy the basic authentication. Â
Some documentation pages have recently moved to a new section: Profound AppDev. If you are having trouble finding specific pages, try the documentation search capability or reach out to our Support team!