In a standard SFN application, there are always some files and folders presented in you project directory, some of them are necessary, some of them are just recommended.
cache/The directory that stores cache copies.
dist/The distribution directory that stores compiled files.
logs/The directory that stores log files.
node_modules/The directory that stores all installed NodeJS modules.
sessions/The directory that stores session files, only appears when using
src/The directory that stores all source files.
assets/The directory that stores static files.
bootstrap/The directory that stores bootstrap files.
index.tsThe default bootstrap file.
http.tsBootstrap files related to HTTP controllers.
websocket.tsBootstrap files related to WebSocket controllers.
- Other files must be loaded by
controllers/* The directory the stores controller files.
locales/* The directory that stores language packs.
models/* The directory that stores models files.
plugins* The directory that stores plugin files.
services/* The directory that stores service files.
utils/* The directory that stores utility module files.
views/* The directory that stores view files.
config.tsThe file of configurations.
index.tsThe entry file of the project.
package.jsonThe specification file of the project.
tsconfig.jsonThe configuration file of TypeScript compiler.
Apart from these, you can create any files and folders you want, just make sure they'll be loaded properly.
(NOTE: * indicates the files in the current item is hot-reloadable.)
The hot-reloading feature was introduced since SFN 0.3, back then only controllers that can be hot-reloaded. However, since version 0.5, SFN introduced a new hot-reloading model via Alar framework, now almost all facilities in a SFN project will be hot-reloadable.
The switch to turn on hot-reloading feature is
config.hotReloading, which is
now set to
true by default, that means the moment you install SFN and run the
program, your program will be watched and is waiting to hot-reload any source
file that may potentially be modified at runtime.
But there are things need to be considered since your program will automatically reload the imported modules, which means any state, memory cache, variables, etc. will be wiped out once reloaded, you have to change your development habit and design your program to be stateless. If doing so is hard for you, just turn off hot-reloading, and it's fine.