refactored svg generation out of the express route handler