This project serves as the backend for the MO:VES project for the DPS945 Spring 2019 for ICVA client.
This backend is currently deployed on Heroku. Click usage to view usages of routes, please update if some of them does not make any sense, and feel free to add comments thru the usage.json file
The main schemas we will be working with are
user-account
content
personnel
(the employee directory)announcement
(alerts)
File structure (important files):
├── routes │ ├── announcement.js // handles all announcement related routes │ ├── content.js // handles all content related routes │ ├── personnel.js // handles all personnel related routes │ └── user-account.js // handles all user-account related routes ├── schemas │ ├── emergency-contact.js // TBD │ ├── mdl-announcement.js // contains the announcement schema │ ├── mdl-personnel.js // contains the personnel schema │ ├── mdl-user-account.js // contains the user-account schema │ ├── media-content.js │ ├── profile.js │ └── text-content.js // contains the content schema ├── server.js // handles server startup ├── services │ ├── db-manager.js // Starts and prepare the MongoDB connection │ ├── msc-announcement.js // database manager for announcement routes │ ├── msc-content.js // database manager for content routes │ ├── msc-personnel.js // database manager for personnel routes │ ├── msc-user-account.js // database manager for user-account routes │ └── passport-service.js // provide various guard middlewares for authentaication, claim check ├── util.js // stores all pre-defined constants such as route names & information, secrets, claims, various helper functions └── views └── usage.html // usage information for client side
It is suggested all constant values are saved in util.js
, and all validation logic stored in passport-service.js
as middlewares. But the claim validation logic may need to be hardcoded into each routes depends on the business logic
passport-service.js
auth_guard
- middleware used for authorization checkprotective_guard
- middleware used for routes that maybe accessible by both registered users and non-registered usersclaim_guard
- middleware to do claim check, the claims(or roles) are to be defined inutils.js - FULL_PATHS
for each route