added support to pass a express app instead of the port