update example
add function middleware