What I want to do:
I want to start a backend node.js server in step 1 of my pipeline (port 5000); and from the second step of the pipeline, I want to call one of its public endpoint.
The scenario:
I have two repos, one for frontend, and the other for backend. The yml file is present in the frontend repo and I have made all configurations in bitbucket to provide my frontend pipeline the access to clone my backend repo, so all good on that. The server also starts fine on the first step:

My YML:

The issue
In the second step, when I curl GET the public endpoint e.g: http://localhost:5000/search, I get the error:
<span>curl: (7) Failed to connect to localhost port 5000: Connection refused</span>
Screenshot:

I think this is because when we get to step 2 the build in step 1 is already torn down so the server is not available?
How can I access the endpoint in second step so that the curl request passes?
Thanks for any help, much appreciated.