add demo code for middle ware