cse110-fall21-group9 / Digital-Cookbook-App

A digital cookbook app engineered by UC San Diego CSE 110 Group 9 for the Fall 2021 quarter. A desktop app that uses electron and other web technologies.
1 stars 1 forks source link

Decide on backend interface #18

Closed haxoc closed 2 years ago

haxoc commented 2 years ago

EDIT: With Electron, our definition of a backend has changed. Electron's entry point in ./assets/scripts/main.js is effectively a fake server run inside the window that has access to a Node environment. This means that we will need somebody from frontend to use the ipcRenderer API and somebody from backend to use the ipcMain API. These can be used to send messages between the local backend that I've partially defined via the IOSystem class and the front end. You can read more about the idea of message-sending in general on stackoverflow & similar websites.

As a front end import pandas engineer I want to have a stable and defined way to make calls to the recipe API and get recipes in a specific format.

Lord-Scrubington-II commented 2 years ago

A brief overview of how the backend and frontend will interface with Create/Update operation as an example: For front end:

  1. User inputs text and integers into the compose recipe form and clicks save
  2. Front end script builds a JSON object from the information entered Now 2 things happen at once: a) front end script sends a message to the backend requesting a that the JSON file be dumped to the file system at a specific directory. this message should contain the JSONobject as a payload. b) then, the front end script will inject the cached JSONobject into a web component and use it to render a new recipecard in the home page. For back end:
  3. Back end receives message ordering a file dump to a specific directory with the JSON payload
  4. Back end constructs a file handle from the payload (using either a Blob , Node.js Buffer , or whatever else is convenient) and uses the IOSystem to dump it to the disk
  5. Send a response back to the front end confirming the success of the write order. Other types of requests will have a similar control flow.
Lord-Scrubington-II commented 2 years ago

Our backend interface with the filesystem module has been decided upon and our transmission protocols have been synced.