added apiLog and middle ware