Add middleware for printing result, post and pre.