You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Load NPM modules needed: do "npm i" in all directories
Start backend: backend/index.js. Make sure that it has executable bit set. If you are running it on a remote machine, you will have to update the value of "Access-Control-Allow-Origin" headers inside the code manually.
Launch Redis. If you use a Redis server working on another host or non-default port number, you can set the host name and port number as command line argument for mid-end as documented in the mid-end's ./index.js --help output
Start mid-end: midend/index.js. Make sure that it has executable bit set. If you are running it on a remote machine, you will have to update the value of "Access-Control-Allow-Origin" headers inside the code manually.
Set up an http server for front-end (Important: browsers will not send XHR if the page is loaded from a local computer as a file)
Open front-end page in the browser
DESIGN CONSIDERATIONS
Normally, a cookie based auth is greatly discouraged for an "APIsed" program, but there was no trivial way to pass it on through inside a multipart form data without buffering the whole request and reducing server's responsiveness considerably
All XHR CORS nastiness with manual header editing comes out of the aforementioned
Since I had less than a day to fix a prettier version of the front-end that I mistakenly overwrote a day earlier, I simply based everything on the original React's "hello world" sample and went without code packaging. The in-browser JSX compilation is used for the same reason. jQuery was used for ajax handling as the only React compatible ajax libs are not broweser ready (require compilation/packaging)
Since both sqlite and redis modules forces use of their asynchronous api, it would've been better to use something like a sunchronous OOP wrapper around them. There is no merit in using asynchronous code within asynchronous request handler function as we can't give response earlier than we get/process data to and from databases