I want the functionality of connect.static
, but I want to inject code into any HTML and JavaScript files that are served.
connect.static
to modify the data it serves?connect.static isn't the right choice for this. The static middleware is specifically for serving static content directly from disk.
Look at connect-assetmanager (https://github.com/mape/connect-assetmanager), it has a serveModify hook that should do what you're needing.