A Cloudflare Worker that exposes the PHP-Frontend of a teacher's grading system as an API
I wanted to build something with React.js and had the idea of my GraM-Frontend project. I couldn't build it purely client-side because of missing CORS-Headers on the GraM-Site that prevented me from making requests and reading the response. I initially wanted to give up on this project because of this limitation.
The API is hosted using Cloudflare Workers which is server-side JavaScript that is executed on each request on a Cloudflare Server near your location. When you make eg. a login request, the Worker will make a request to the PHP frontend of GraM and obtain a login cookie that way. It is then sent back as JSON data so that the application can make other requests.
After creating this I remembered that I had created an Android App in 2018/19 which fetched the whole page (including inline CSS and HTML) on each refresh of the data. Using this API not only prevents stealing passwords in our unsecured school WIFI but also saves a lot of data and battery power by offloading the HTML parsing to Cloudflare!
Currently there is no support for viewing or ticking homework because I can't reverse engineer it without an active homework on my account.