added basic function of middleware

update basic function