diff --git a/.dockerignore b/.dockerignore index dbfcce8..8b8889e 100644 --- a/.dockerignore +++ b/.dockerignore @@ -2,3 +2,6 @@ node_modules coverage logs .env +data +logs +apidoc \ No newline at end of file diff --git a/SETUP.md b/SETUP.md new file mode 100644 index 0000000..dc2e6a0 --- /dev/null +++ b/SETUP.md @@ -0,0 +1,47 @@ +# TCET ERP System + +Made in mind for testing APIs, database replication, providing data to frontend. + +## Installation for Testing + +### Prerequisites + +Well before anything, you will have to install WSL. All you have to do is: + +`wsl --install` + +After this, you will need to restart. + +Install Docker Desktop, it is docker bundled with a frontend. It will allow you do get the backend and databases up and running without any other installation steps. + +The link for downloading Docker Desktop is given below. + +[Docker Desktop Installer](https://desktop.docker.com/win/main/amd64/Docker%20Desktop%20Installer.exe) + +Again, you will need to restart. + +### Installation + +After this, use these commands to set up the databases and the backend. + +```bash +docker-compose pull +docker-compose up -d +``` + +The last step is a troublesome one, but a very necessary step. You will have to change your hosts file. On Linux, it will be in `/etc/hosts/` (use sudo vim/nano/any editor with admin privs and go to the next step). For Windows, it will be in `C:\Windows\System32\drivers\etc\hosts`. Open Notepad(or any code editor) as Admin, and open the specific hosts file, and go to the next step. You can use Microsoft PowerToys to change your Hosts file using the Hosts file editor. + +Add the following to your hosts file. +``` + 127.0.0.1 mongo1 + 127.0.0.1 mongo2 + 127.0.0.1 mongo3 +``` + +And voila! You have the backend set up! It will be running on port 4000. + +You can use MongoDBCompass to login with the URI specified in the `docker-compose.yaml` and the `.env.sample` + + + +NOTE! If, for any reason, the backend doesn't work, try restarting the backend container in Docker Desktop, in the Containers tab. \ No newline at end of file diff --git a/_apidoc.js b/_apidoc.js index 616b79f..4d67b4e 100644 --- a/_apidoc.js +++ b/_apidoc.js @@ -718,7 +718,7 @@ /** * @api {post} /exam/add Add Exam * @apiName AddExam - * @apiExam Exam + * @apiGroup Exam * @apiDescription Add a new exam. * * @apiBody {String} title Exam title. @@ -1068,7 +1068,7 @@ /** * @api {delete} /exam/delete/:id Delete Exam * @apiName DeleteExam - * @apiExam Exam + * @apiGroup Exam * * @apiParam {ObjectId} id The ObjectID of the exam to delete. * @@ -1170,7 +1170,7 @@ /** * @api {post} /exam/update/:id Update Exam Details * @apiName UpdateExam - * @apiExam Exam + * @apiGroup Exam * @apiDescription Update existing exam details. * * @apiParam {ObjectId} id The ObjectID of the exam to update. @@ -1336,7 +1336,7 @@ /** * @api {get} /exam/list Get Exam List * @apiName GetExamList - * @apiExam Exam + * @apiGroup Exam * * @apiQuery {String} [title] Title of the exam. * diff --git a/docker-compose.yaml b/docker-compose.yaml index 74da3c1..24f486a 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -31,3 +31,12 @@ services: - ./data/mongo-3:/data/db ports: - 30003:30003 + + backend: + build: . + container_name: backend + env_file: + - .env + command: ["npm", "run", "serverstart"] + ports: + - 4000:4000