ticket:3 add middleware
Merge branch 't3_middleware'