middle ware routing for restful api