Consider two requests, one to the frontend and one to the backend.
The frontend request will take the below path through the docker containers.
-
Hits the reverse proxy, dubbed the
proxy
container, which will redirect any traffic that isn't supposed to go toapi/
to the frontend.- This routing is to allow the front end to return the home page for any request that isn't directly to the API. This allows for custom error pages and handling of custom routes inside of the SPA.
-
Hits the nginx file server in the frontend docker image.
- The file server allows the serving of custom static content from angular while also allowing for default serving of index.html is unable to find the correct file to server, ie if trying to serve a custom route.
-
Loads the file from the frontend file server and sends back.
The backend request will take the below path through the docker containers.
- Hits the reverse proxy and because it matches
api/
it will be directed to the server docker container. - Is handled by the server.
Each base route in the application, ie /tutors/
, is a separate route in the app-routing.module.ts
file. You can copy the syntax,
{
path: 'coord',\
canActivate: [AuthGuard, AdminAuthGuard],
canActivateChild: [AuthGuard, AdminAuthGuard],
loadChildren: () => import('./coord/coord.module').then((m) => m.CoordModule),
}
to add a new route.
Then add a new module with its own routing.
*Caveat: Routing is handled in order, ie if two routes match the current route, the first route will be the one the user sees.
You can view the API docs at api/swagger
, this documents all of the current endpoints and objects available for usage.
This project uses DRF (Django Rest Framework) for serving objects through the ORM, to add objects please refer to that documentation as it describes best practices for a REST API.