When one day isn’t enough
The first half of my day was spent in communication with recruiters and potential employers, and applying for jobs.
The last part of my day I poked at the Todo-List app. It was my intention to get the Basic Authentication working with the Checkvist API to get actual tasks into my todo list (instead of the titles of quiz questions). On Postman this works flawlessly. I can modify the request header to get the authentication working and the API returns tasks for the supplied task list. However, on my development environment, this failed. Meet my old frenemy, CORS.
CORS is an acronym for Cross Origin Resource Sharing. Frequently to save space or download times a website will put some of their content on a different server. A good example of this is downloading libraries (jQuery, Bootstrap, React, Angular) on the fly rather than push them to the browser from the same server as the application. Like reinventing the wheel, why do it if you don’t have to? The issue lies in the browser attempting to save the user from any fraudulent server requests. The browser knows the app is being served from one place (origin) and will prevent content from loading from another URL (cross origin).
To work around this (or truthfully, to work with this feature) the developer needs to add some information into the response headers to reassure the browser “hey, browser, this is safe and intended behavior, really not fraudulent at all”.
All of this information is purely academic because knowing it does not help me fix my bug. I am using a bootstrapped app from create-react-app which is beautiful itself because it comes with all the bells and whistles and serves itself. But the server is abstracted away somewhere deep in the bowels and almost inaccessible. And from what I can tell based on reading the GitHub issues, this server does not run Express which may be required to tinker with the request headers, which will fix my issue. Bottom line - I either need to unearth the server from this behemoth, or add another module so that I can write a small piece that will re-write headers.
I will poke at this again another day. Tomorrow, as per plan, it’s “complete two or more problems on HackerRank”.