call before compile callbacks in middleware