What do people use as MVC controller?

  • Goal:

I'd like to format our data (model) for our UIs (view), and have tried two different approaches. Curious what other people think about this problem.

  1. I started months ago by placing JS one-liners all over the apps. For example: "if this text is too wide, decrease the markdown header from h2 to h3." or "if this data field is empty/null, make the background color gray and the text dark gray"

    • This was great for a prototype, but quickly grew unmaintainable when there might be 20 of these per app and the same sort of formatting treatment needed to be synced across multiple components, modules, and apps.
  2. So then I moved all the formatting to a central SQL query which generated JSON rows in a "gold" table used by multiple apps. This was great for maintainability and visual consistency.

    • However, now we need to build and join on a table full of all-string fields in JSON, which is both poorly-performing and hard to wrangle in queries.

I'm considering an AWS Lambda Function which acts as a Controller, allowing apps to retrieve formatted data. But it would be more work than JS one-liner or SQL.

the Multipage App beta may solve this for us. will try it out and report back

1 Like