Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

370
Visualizações
How do I check if express server is running from python?

So I call my backend.js from my python code like this

# server is requested to start
startServer = subprocess.Popen(['node', 'backend.js'])
# startServer.wait()
if startServer.poll:
    print('Server could not be started')
    sys.exit()

And my backend.js contains

app.listen(port, () => {
  console.log(`Server is listening at http://localhost:${port}`);
});

How can the backend tell python that server for some reason failed to start and exit the program or server has started and now you can go ahead? I have tried waiting for the startServer to end but that just stops the python code until server is stopped. So is there a way by which the callback function in app.listen can send information to the python code?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda