make html inside a middleware from json to pass to your view on the server side