Implements simple server running on Express.js.
- Node.js LTS
- git
- Linux Ubuntu running as WSL on Windows 11
- cd to
./backend
folder and runnpm install
- create
.env
file and provide these key/value pairs:PORT=4000
PICT_LOC=location/of/the/pict
binary, e.g. if it is located in/backend/binaries/pict
and you are starting the server from the./backend
folder, then the value must be./binaries/pict
. Binary is now provided. To ensure, that it will be cloned, installgit lfs
on your system, see HERELOG_FILE_PATH=/var/log/pict-server/server.log
- this example value is also thedefault
value, if this setting is not provided in the.env
file. Make sure, that user, which will run the application on the server (or localhost) has access and write rights to the folders and file!LOG_FILE_LEVEL=warn
- this is also thedefault
value, if this setting is not provided. Sets the minimum level which will be written to log file.LOG_CONSOLE_LEVEL=warn
- this is also thedefault
value if this setting is not provided. Sets the minimum level which is print out to stdout in the console.LOG_ENABLED=true
- this is also thedefault
value, if this settings is not provided. Enabled/disabled logging. However, http requests/responses will be still logged in the console.
- open separate shell window, switch to
./backend
and runnpm run dev
- you can use dockerfile located in the root of the whole project.
- no inner error messages are sent to the frontend
There are two destination of logging data:
.log
file- console
This is done via key/value pairs in .env
file, specifically:
-
LOG_FILE_PATH=/var/log/pict-server/server.log
- this example value is also thedefault
value, if this setting is not provided in the.env
file. Make sure, that user, which will run the application on the server (or localhost) has access and write rights to the folders and file! -
LOG_FILE_LEVEL=warn
- this is also thedefault
value, if this setting is not provided. Sets the minimum level which will be written to log file. -
LOG_CONSOLE_LEVEL=warn
- this is also thedefault
value if this setting is not provided. Sets the minimum level which is print out to stdout in the console. -
LOG_ENABLED=true
- this is also thedefault
value, it this setting is not provided. Enabled/disabled logging. -
recognized log levels are listed HERE