The core service works, now – you can request a file by name, and you will be properly redirected to the S3 download location! The code is mostly clean, and things are looking pretty good.
But, there seems to be a lot of hard coded configuration in the models and routes – something that shouldn't be set up the way it is. Having hard coded strings as configuration means there will be a lot of duplication, potential spelling mistakes and more code to change that you'll want to deal with when moving to production or having to change the configuration.
In this episode, you'll see how to clean up the configuration so that it is easier to manage. You'll see what kinds of information should be moved into configuration, and how to make it work with the EPA module for environment configuration. You'll also see a bit of cleanup with routes and changing the way the default “/” route works for the media service.
Having your code cleaned up and maintainable is an incredibly important aspect of software development. It's something that you should always make time to do, and this episode will demonstrate some of the ways in which Express apps can be kept clean.