Backend of the Pick-by-Light-System
Clone git repository
git clone [email protected]:softwaretechnik-projekt-pick-by-light-system-wise21_22/pbl-backend/pbl-backend.git
Step 1: Install all required node dependencies listed in package.json to local system and run server locally.
cd pbl-backend
npm install
Create and run Mongo database in docker See description
Step 3: Start project described in 1a-c
Server restarts automatically when file changes are observed
npm run dev
Run Server without automatic restarting
npm run start
Compile typescript source into javscript
npm run build
Note: Make sure you have root rights when working with docker on Ubuntu. (sudo)
Setting NODE_ENV to 'docker_dev' to run docker in development mode in develompent mode disableAuth is set to 'true'
NODE_ENV=docker_dev docker-compose up --build --detach
Setting NODE_ENV to 'docker_prod' to run docker in production mode
NODE_ENV=docker_prod docker-compose up --build --detach
docker-compose down
If mongodb container exists and isn`t started yet
sudo docker start mongodb
If mongodb container does not exist
sudo docker run -dit --name mongodb -p 27017:27017 mongo
sudo docker stop mongodb
Command mongosh
is executed in container
sudo docker exec -it mongodb mongosh
After connecting to container, move into Database (Database name defined in config.json):
use pblBackendDb
Example query: Show all items
db.items.find()
Add test data from json-Files tests into mongo database
npm run addData
npm run removeData
Make sure your testing database is empty. Execute tests defined in tests
NODE_ENV=test npm run test