As a requirement for running the application, create an .env
file in the root working directory and define the environment variables there.
See .env.template
for all the environment variables required.
The port number to serve the node server on when executing the npm run dev
or npm start
commands.
For example 3000
.
The connection string to the mongodb database.
To generate a secret key for access and refresh token, execite this command in your terminal:
openssl rand -out openssl-secret.txt -hex 64
The secret will be stored in the openssl-secret.txt
file.
Navigate to the .env
file and set the ACCESS_TOKEN_SECRET
variable to that token value.
Determines the expiration time for the authentication token.
It is composed of <NUMBER><TIME_UNIT>
.
for example:
30s
- is 30 seconds30m
- is 30 minutes30h
- is 30 hours
You can set the NUMBER and the TIME_UNIT to your liking.
Determines the expiration time for the authentication refresh token.
You should define it in the same way as TOKEN_EXPIRATION
.
Install the required node packages:
npm i
Start the appliation:
npm start
Run the application with nodemon:
npm run dev
Run tests:
npm run test
See our master
test coverage at https://taljacob2.github.io/colman-advanced-web-apps