The serve method now supports closure as an alternative to class name