You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Document Management System (Node, Express, Mongo)
4
5
5
-
## Models
6
-
The models contained are `users`, `documents` and `roles`. A document belongs to a `User` and is related to them using the `ownerId`. A `Role` is related to the `User` using the `id` field. Each `Document` has restrictions on the roles. A `Role` also relates to the `Document` using the `title`.
6
+
## Models
7
+
8
+
The models contained are `users` and `documents`. A document belongs to a `User` and is related to them using the `ownerId`. A `Role` is related to the `User` using the `id` field. Each `Document` has restrictions on the roles. A `Role` also relates to the `Document` using the `title`.
7
9
8
10
## Testing
9
-
Testing is done using the `superagent` node module which is installed via `npm` when you install all the other node modules in `package.json`. `superagent` is used to make requests to the api routes and receive responses. The tests are run on terminal using the command:
11
+
12
+
Testing is done using the `superagent` node module which is installed via `npm` when you install all the other node modules in `package.json`. `superagent` is used to make requests to the api routes and receive responses. The tests are run on terminal using the command:
13
+
10
14
```
11
-
jasmine-node tests/ --verbose
15
+
mocha tests/ --verbose
12
16
```
13
17
14
18
## Express Routes
19
+
15
20
The routes are created using `express` routers. The server needs to be started using the terminal command `nodemon server.js`. Our server file is called `server.js`. The routes are defined in the `./server/routes/api.js` file.
16
21
17
22
## Mongo Database
18
-
One needs an installation of `Mongodb` locally. Our database is called `docms`. We connect to it using the configurations in `./server/config/config.js` file.
23
+
24
+
One needs an installation of `Mongodb` locally. Our database is called `docs_api_node`. We connect to it using the configurations in `./server/config/config.js` file.
25
+
19
26
```
20
-
'database': 'mongodb://localhost/docms',
27
+
'database': 'mongodb://localhost/docs_api_node',
21
28
```
29
+
22
30
This line in particular is needed. To use this database throughout the run-time of the application, one needs to run the command `mongod` on the terminal.
23
31
The database needs to be dropped first, before the tests are run. It is dropped in the express server by the command:
0 commit comments