This is the BanCode back-end API project.
Install all dependencies with the following command:
npm install
The .env file must be configured followinf the .env.example file. You can simply copy one file into another with the command:
cp .env.example .env
Below is an explanation of every config variable:
PORT=3000 // Application port
DB_URL=url // MongoDB connection URL
The application can be run in two ways:
Running as dev starts the application with nodemon to make changes quickly available.
npm run dev
Building and Running is often used for production environment. Simply run:
npm start
Always make sure that your code meets the standards of this repo before commiting. There's two checks that you must do:
- copy paste detection (npm run jscpd)
- standardjs detection (npm run standard:fix)
The pre-commit hook will NOT allow commits with codes not following StandardJS.
All the commands below are available to be used as pleased.
Command | Description | Example |
---|---|---|
clean | Removes the build/ folder. Used before every build | npm run clean |
build | Uses babel to build the application to the build/ folder | npm run build |
start | Calls clean, build and then starts the server located at build/ folder | npm start |
dev | Runs the server with nodemon in development mode. | npm run dev |
test | Runs jest to execute all test files | npm run test |
standard | Checks if the code meets StandardJS requirements. | npm run standard |
standard:fix | Checks if the code meets StandardJS requirements and auto-fix some of the errors. | npm run standard:fix |
jscpd | Checks the src/ folder for copy-pasted code. | npm run jscpd |