/pouch-db-app

A small app to demonstrate PouchDB and its capabilities.

Primary LanguageTypeScript

PouchDB app

Pre-requisites

season-app-server(back-end)

  • Navigate into the season-app-server directory.
  • Through a terminal you can start up the Node server by executing:
node season-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

  1. User makes a request to season-app-ui.
  2. Angular will make a request to the server season-app-server on localhost:8888
  3. 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.
  4. Since the response was a 200: OK, Angular will save the response in PouchDB.
  5. The response will also be sent back to the user so they can see the season value.

When the server fails

  1. User makes a request to season-app-ui.
  2. Angular will make a request to the server season-app-server on localhost:8888
  3. The server will respond with a bad response e.g. 500: Internal Server Error.
  4. 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.
  5. The response will also be sent back to the user so they can see the season value.