Running Node scripts from within Hugo (shortcodes)

I really like the data-driven content feature, but what if instead of getting data from an API, one could simply run an arbitrary node script (or execute some bash) locally and get the return value or standard out from that?

This would mean I could run calculations for my shortcodes on the server and send the results with the rest of the static content.

Is this already possible in some fashion?


Is it a silly idea, though? :thinking:

No, it has been endlessly discussed (not Node scripts, that sounds a little bit silly, but what do I know), but allowing custom program execution from templates – but I have been holding back, mostly for security reasons.

Makes sense. Thanks!