Skip to content

Dagasma/In-Book

Repository files navigation

IN-BOOK

Spice of Life Web Application

Requisite

On any linux distro download the following package using your favorite package manager:

sudo apt-get install git npm nodejs

Configuration File ENV

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

Starting Guide

  1. Clone the current repository with
git clone https://github.com/Dagasma/CommunityAllert
  1. Move inside the cloned folder with cd and install all required component with NPM
cd CommunityAllert/backend
npm install
  1. Run the package's test with NPM
npm run test
    • Run the page locally using node.js
    npm run start
    ELSE
    • Run in development mode using
    npm run dev
    with this command on every change of any .js file the server will automatically restart.

Download Node.js on windows

  1. Download Node.js https://nodejs.org/en/download/
  2. Check the version
npm -v
node -v
  1. Open shell and install npm
npm install -g npm

Guide

  1. Documentation https://nodejs.org/docs/latest/api/
  2. Italian guide of node.js https://www.youtube.com/watch?v=J5Ac3yVedgU&list=PLCBrF3nJN_i150hB-9zfXhHamDMVyA2R9&index=4
  3. English guide of node.js https://www.youtube.com/watch?v=TlB_eWDSMt4