Goldocs is a document management system API built out in Javascript. It allows the end user to be able to create documents, and be able to share them with other people.
- Clone the repository on your machine using the command:
git clone https://github.com/andela-skieha/document-management-system.git
- Navigate to where you cloned the project and
cd
into it:
cd path/to/project/document-management-system
-
Run
npm install
to install the project's dependencies. -
Create a
.env
file in the root of the project and set the environment variables needed to run the project:
MONGO_PROD_URL=mongodb://localhost/dms
MONGO_TEST_URL=mongodb://localhost/dms-test
MONGO_SECRET='this is super secret'
- Run
npm start
to get the server running.
- Navigate to where you cloned the project and
cd
into it:
cd path/to/project/document-management-system
- Run
npm test
to seed the database and run tests for the system.
- Signup
POST
http://localhost:5000/api/users/signup
- Login
POST
http://localhost:5000/api/users/login
- Get all users
GET
http://localhost:5000/api/users
- Get user by id
GET
http://localhost:5000/api/users/:user_id
- Edit user details
PUT
http://localhost:5000/api/users/:user_id
- Delete user account
DELETE
http://localhost:5000/api/users/:user_id
- Create new document
POST
http://localhost:5000/api/documents
- Get all documents
GET
http://localhost:5000/api/documents
- Get document by id
GET
http://localhost:5000/api/documents/:id
- Edit document details
PUT
http://localhost:5000/api/documents/:id
- Delete document
DELETE
http://localhost:5000/api/documents/:id
- Get documents belonging to a particular user
GET
http://localhost:5000/api/users/:user_id/documents
- Get document by roles
GET
http://localhost:5000/api/search?role=role_title
- Get documents by creation date
GET
http://localhost:5000/api/search?date=created_at_date
- Get paginated documents
GET
http://localhost:5000/api/documents?limit=set_limit&offset=set_offset
- Create new role
POST
http://localhost:5000/api/roles
- Get all roles
GET
http://localhost:5000/api/roles
- Get role by id
GET
http://localhost:5000/api/roles/:id
- Edit role details
PUT
http://localhost:5000/api/roles/:id
- Delete role
DELETE
http://localhost:5000/api/roles/:id
- Get roles belonging to a particular user
GET
http://localhost:5000/api/users/:user_id/roles
-
Run
npm start
to start up the server. -
Open up Postman on your machine.
-
Visit the
signup
route above and create a new user with the POST verb.
POST
http://localhost:5000/api/users/signup
- Visit the
login
route above and with the new user'susername
andpassword
, login to get a token:
POST
http://localhost:5000/api/users/login
- Take the token created, and set it in the
Headers
section of Postman in order to be able to access the rest of the routes:
x-access-token: token_received_on_login