configurar acesso externo

This commit is contained in:
Luiz Silva 2024-09-13 15:54:43 -03:00
parent a667b04285
commit 3bd075c39d
2 changed files with 639 additions and 632 deletions

View file

@ -143,18 +143,21 @@ gerar.then(() => {
.send(html404.replace("{ERRO}", `Página não encontrada: ${request.url}`)); .send(html404.replace("{ERRO}", `Página não encontrada: ${request.url}`));
}); });
const jaEstaRodando = fetch(`http://127.0.0.1:${PORTA}`) const jaEstaRodando = fetch(`http://0.0.0.0:${PORTA}`)
.then(() => true) .then(() => true)
.catch(() => false); .catch(() => false);
jaEstaRodando.then((jaEstaRodando) => { jaEstaRodando.then((jaEstaRodando) => {
!jaEstaRodando && !jaEstaRodando &&
fastify.listen({ port: Number(PORTA) }, (err, address) => { fastify.listen(
if (err) throw err; { port: Number(PORTA), host: "0.0.0.0" },
console.log( (err, address) => {
`${new Date().toISOString()} Servidor ${PREFIXO} Rodando em ${address}`, if (err) throw err;
); console.log(
}); `${new Date().toISOString()} Servidor ${PREFIXO} Rodando em ${address}`,
);
},
);
jaEstaRodando && console.log(`Servidor ${PREFIXO} já está rodando`); jaEstaRodando && console.log(`Servidor ${PREFIXO} já está rodando`);
}); });

File diff suppressed because it is too large Load diff