Spice of Life Web Application
On any linux distro download the following package using your favorite package manager:
sudo apt-get install git npm nodejs
Using the library dotenv, we can store every useful configuration element, like the database host or the database password, in a separated file. Obviously the file WILL NOT be uploaded in the repository, thus must be created on your own with the name '.env' in the root folder. This file must define these variables:
PORT = NUMBER_HERE //The port number of the DB
DB_HOST = STRING_HERE //Database Host IP address
DB_USER = STRING_HERE // Database user
DB_PASSWORD = STRING_HERE // Database password
DB_NAME = STRING_HERE // Database name
SECRET = STRING_HERE // Random generated string to encrypt sessions
- Clone the current repository with
git clone https://github.com/Dagasma/CommunityAllert
- Move inside the cloned folder with cd and install all required component with NPM
cd CommunityAllert/backend
npm install
- Run the package's test with NPM
npm run test
-
- Run the page locally using node.js
ELSEnpm run start
- Run in development mode using
with this command on every change of any .js file the server will automatically restart.npm run dev
- Download Node.js https://nodejs.org/en/download/
- Check the version
npm -v
node -v
- Open shell and install npm
npm install -g npm
- Documentation https://nodejs.org/docs/latest/api/
- Italian guide of node.js https://www.youtube.com/watch?v=J5Ac3yVedgU&list=PLCBrF3nJN_i150hB-9zfXhHamDMVyA2R9&index=4
- English guide of node.js https://www.youtube.com/watch?v=TlB_eWDSMt4