feat(API): add middleware feature leaving behaviour of before and after untouched