Through a terminal you can start up the Node server by executing:
nodeseason-app-server.js
In your browser, navigate to:
localhost:8888
season-app-ui (front-end)
Open up a new terminal window.
Navigate into the season-app-ui directory.
The UI is an Angular 8 App. To start the application just execute the command below:
ng server -o
Architecture
When the server is up and running
User makes a request to season-app-ui.
Angular will make a request to the server season-app-server on localhost:8888
The server will respond with a status 200: OK and the body with a SEASON object that will have either of the values SUMMER, WINTER, AUTUMN or SPRING.
Since the response was a 200: OK, Angular will save the response in PouchDB.
The response will also be sent back to the user so they can see the season value.
When the server fails
User makes a request to season-app-ui.
Angular will make a request to the server season-app-server on localhost:8888
The server will respond with a bad response e.g. 500: Internal Server Error.
Since the response was a 500: Internal Server Error, Angular will fetch the response value from PouchDB which was stored when the server responded with a 200 OK status.
The response will also be sent back to the user so they can see the season value.