Member-only story
Mnemonic Maker
My friend Sean and I recently completed a really cool project that scrapes the web for lyrics and generates an acrostic mnemonic device based on user input. If you’d like to check out the project, you can view the demo link here and the code here (frontend / backend).
Looking back on completed projects, one can always find room for improvements. Here are a couple of things we could have changed/implemented from the start.
Services/utils.js Fetch Response Handling
When I know there’s going to be many fetch requests in a particular project, I love to place all of the fetches in one central file. I typically create one variable called BACKEND that is called in all of the fetches, and upon deployment it’s easy to swap out the backend URL.
Something I would have done differently is create a single function to handle each of the fetch responses. That way if the response is a 200 status it returns response.json(), other response statuses may send out an alert instead. This would help with errors during development and can be recycled across multiple projects. I would also be able to more easily toggle the console logs on and off for fetch requests.
CSS
I would have liked to keep styling uniform throughout the application. CSS can be a real pain and in-line styles are a bit easier. We should have chose a single path — either in-line or CSS, not both.