Welcome on the backend of this app.
This end use Express for the server and Sequelize as ORM for PostgreSQL.
You must set the config of the app. I used an .env
file as config files. It's much secured than .json files
The variables set in the .env
files will be loaded and put in the process.env of Node.JS, accessible anywhere in the backend.
Example of .env
file
DATABASE_URL=postgres://db_user:db_password@db_server:db_port/db_name
DATABASE_USER=your_db_user
DATABASE_PASSWORD=your_db_password
DATABASE_SERVER=db_server
DATABASE_PORT=db_port
DATABASE_NAME=db_name
DATABASE_SCHEMA=db_schema
DIALECT=postgres
APP_PORT=your_app_server
TOKEN_SECRET=your_token_secret
The first config concerns the DB, for that , you must set :
.env
DATABASE_URL
= The URL containning all infos necessary to connect to the DB. If not set, collect others DATABASE_*** var in the.env
fileDATABASE_USER
= The DB user to connect asDATABASE_PASSWORD
= The User password, Make sure this file is not public, otherwise your DB is compromisedDATABASE_SERVER
: The URL to the DB serverDATABASE_PORT
: The DB server port, by default this var is set to5432
DATABASE_NAME
: The DB name, not the schema nameDATABASE_SCHEMA
: The DB schema to use
The DB ORM is Sequelize and his dialect is set to Postgre. The pool size is to (min.) 2 - 5 (max.) with an idle time set to 10000 ms.
If the DB schema is not created, it'll be on the boot of the app.
The next config is about the server. For that, you must set :
.env
APP_PORT
= The port to listen for the server. By default, it's :3030
APP_TOKEN_SECRET
= It's the secret used to sign the token. If not set, it's will randomly generated for the lifetime of the app.DATABASE_PASSWORD
= The User password, Make sure this file is not public, otherwise your DB is compromised
On npm start
, the app use nodemon to restart if crashes
This project is licensed under the MIT license. See the LICENSE file for more info.