creating express middleware