Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usar .env para a porta do servidor #3

Open
GRFreire opened this issue Aug 27, 2019 · 1 comment
Open

Usar .env para a porta do servidor #3

GRFreire opened this issue Aug 27, 2019 · 1 comment

Comments

@GRFreire
Copy link

Fala turma!
Estava pensando em utilizar o .env para definir a porta, assim outros serviços como o heroku poderiam rodar o servidor. Acho que o código ficaria parecido com isso:

const port = procces.env.PORT || 80

webServer.listen(port, function(){
  console.log('> Server listening on port:', port)
});
@lnsantos
Copy link

Da para criar um arquivo chamado .env ,
e dentro do arquivo coloque o PORT =procces.env.PORT || 80, e para efetuar a chamada dassa porta no código só coloca process.env.PORT no local desejado.
Só uma dica, acho bastante interessante isso, caso queira testa.

Paulo-cpereira added a commit to Paulo-cpereira/Follow-Thru that referenced this issue Oct 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants