Connect middleware to manage Postgres connections.