[feature] add middleware support