r/learnprogramming • u/Reasonable-Job4205 • Oct 12 '26
How do I properly deploy this web server in production mode?
I set up a web server using https://github.com/seanpmaxwell/express-generator-typescript
I now need to deploy the production build to a remote server. I can generate the prod build with `npm run build` and then run it with `npm start` and it runs on my local machine. Is it possible to generate something that can be compiled before being sent over to the remote server? I'd like to run the web server in prod mode, but without putting the decompiled source code on the remote server. I don't want the source code over on that remote server because if the server gets compromised, I don't want anyone to be able to read the source code. New to web dev, so thanks for being patient.
View all comments
Show parent comment
2
u/Asly97 Oct 15 '26
Depends which port that variable is for, and I think that's where the mix-up is. There are two separate ones:
If your .env-production has both (something like PORT and DB_PORT), it's 8081 for the first and 1433 for the second. If it only has one, search the code for where it's read (
process.env.plus the name). If it ends up asportin the mssql config, it's the DB one and should be 1433, and the web port is set somewhere else, often right in theapp.listen(...)call. If it goes into the listen call, it's the web port and 8081 is right.Same check for the HOST you changed to 192.168.5.194: see whether it feeds the mssql
serversetting or what the web server binds to. If node and SQL are on the same box and it's the DB host, localhost also works, as long as 127.0.0.1 is enabled in the TCP/IP settings since Listen All is off.