make middleware configurable and check for PORT environment variable