spencerlepine / woofer

Dating app for pets - a full stack MERN project. Complete with CI/CD pipeline w/ Jest, GitHub Actions, Docker Hub, and AWS EC2
https://youtu.be/aiJhCoZRc78
2 stars 1 forks source link

Removing CONSTANTS in code #73

Closed spencerlepine closed 2 years ago

spencerlepine commented 2 years ago

Situation:

The Express server was referencing the DATA_KEYS file for object key names everywhere. This required an import statement in every file, and usage made the code hard to read.

Task:

Need to make the backend code easier to read. Constants are not needed throughout EVERY file, because we have tests to verify everything works.

Action:

Removed the constants file, and removed all imports throughout the express app. Instead of referencing constants, I hard coded the object keys, since they were common, like "userId"

Result:

Code was much easier to read, and we simply rely on tests to pass to know that functions are still working.