add method middleware