-
Notifications
You must be signed in to change notification settings - Fork 0
Structure
David Park edited this page Oct 19, 2023
·
2 revisions
- All the files for frontend work are in
frontend/src
. -
frontend/src/component
contains all the React components for frontend pages. -
frontend/src/api/
contains all api files which are used for communication between frontend and backend.
Three main folders for backend include:
- Models in
backend/models
- Routes in
backend/routes
- Services in
backend/services
- In order for frontend pages to communicate with backend (such as database), the flow of data is router -> handler -> actual functions (business logic)
- For example, in order to create a new Stakeholder model, the data flow would be:
- Call
createStakeholder
function instakeholderAPI
, which is infrontend/api
. - To handle the API call, the router in
routes/stakeholder.js
will call handler, which is inservices/stakeholder/stakeholder.js
. - The
createStakeholderHandler
function will first do validation in order to check if the user has correct access. - If the validation fails, the attempt to create a new Stakeholder model will fail.
- If the validation succeeds, it will call
createStakeholder
function, which creates the stakeholder model.
- Call
- Models represent the various types of abstract objects in database that are used for the project.
- It includes Group, Person, Ownership, etc.
- Routes represent the routers for API calls.
- They decide on which backend function (handler) they will use to handle an API call.
- loader/express.js are used.
- Services represent handlers, which are business logic (functions) that does actual work that can modify the database (backend).
© 2023 University of Toronto, CSSE