-
Notifications
You must be signed in to change notification settings - Fork 15
Our Code Structure
This is code than runs strictly on the browser. In this project, all of the code is found in src/
- Anything that has it's own webpage can be found in
src/Pages/
- Anything that is used across webpages can be found in
src/Components/
- React components call on functions defined in
src/APIFunctions
which then send requests to the API endpoints. - This abstracts
axios
POST and GET requests - Below is an example of how our code for our Event service is structured.
This is code than runs strictly in the "backend." We can see that the Web Server is spread accross the diagram, which represents our microservices.
This service is responsible for interacting with Google Cloud APIs. The code for this server can be found in api/mailer/
. api/cloud_api/routes/mailer.js
holds the Express.js endpoints to this microservice and api/cloud_api/util/SceGoogleApiHandler.js
is a class responsible for handling tokens from Google and invoking cloud services.
This microservice interacts with all of the other microservices to store error information. The Express endpoints for this service can be found in api/logging_api
. We also store information related to sign messages and to call on this service from other services, api/main_endpoints/util/logging-helpers.js
is used.
In the future the logging server when given a more serious error should send an email via the Email server to alert officers of something breaking. Furthermore, printing analytics will be stored using this service to help us understand the usage of our printers.
This service contains the majority of our backend code. This includes member, officer, event and 3D print request management. The Express endpoints for this service can be found in
api/main_endpoints/
.
For information on this, please check out the SCE-RPC wiki code structure page.
- MongoDB models for our data is located in
api/models
- These models are imported at the top of API Endpoint files and are used to search, add, edit and delete data in MongoDB.
- API endpoints can be found in
api/
- These endpoints receive HTTP requests from the User, made from functions in the
src/APIFunctions
directory.
For information on this, please check out the SCE-RPC wiki code structure page.
- Write an API Endpoint.
- Create a function that can call on this endpoint located in
src/APIFunctions
. - You can now import this function in your React component and call on it.