The context is that I am writing a webserver code for Espruino which will serve most file extensions off the SD card, but if it sees certain extensions (indicating that the page should be dynamically generated), it will see if there's a function to generate that page, and call it if so.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
@DrAzzy, is that the requirement?