Nice post. Your suggested way is how I write route handlers. I usually define them as a static method in a class, export the class and then finally call the static method on the class as my route callback.
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.