Update middleware.js

added option to include metadata tendered by underscore template engine