How do I access my express API in production? - reactjs

I'm running a local express server at Port 5000. However, when I fetch http://localhost:5000/api from my react webapp (XAMPP), the server does not respond. How would I self host my express app to make it accessible from anywhere, not just during development.

Ideally, if your express server is running on port 5000 then it should be accessible by localhost:5000 or 127.0.0.1:5000. Try looking at your console logs in your browser for details(provide more information). Another thing to look out for is to check if it's running on http or https in production.
By default the server will run on all interfaces, not just localhost, so you can access it remotely by using its IP address on that network. (see https://stackoverflow.com/a/33957043/9726680)

Related

Opening up https proxy port on google cloud platform

I'm building a simple web app (MEAN) and deploying to GCP (Google Cloud Platform) I have built an application where my client runs on 4200 and the server runs on port 3000. I have two choices, combine my client and server to run on the same port, or simply allow the connection between 4200 and 3000. Currently, I get an error trying to proxy requests between these two ports. Any ideas how I open 3000 so 4200 can talk to it?

JDBC Connection times out in deployed web app with hosting service

I am using JDBC to create a connection to an MS SQL Server Database. The same code and connection string works fine on a number of platforms and in particular in my spring MVC Web Application.
After deploying the web application to a remote tomcat hosting service, everything appears to work fine in the code except that the database connection times out.
"com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host <IP Address>, port 1433 has failed. Error: "connect timed out. Verify the connection properties. Make sure that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. Make sure that TCP connections to the port are not blocked by a firewall."
The hosting company says I must provide the exact steps to recreate the problem which may not be ideal. The only thing I can think of is to write another cut down application that connects to a different db with different credentials and test that in dev and deploy and then email them the war so they can deploy it and test it in their own environment.
Does anyone know of reasons why this might happen with a hosting service, like blocking the database response for some reason? Or is this very unlikely and should I assume that I am doing something wrong and persevere in understanding what might be different between my dev app and deployed app that could cause this timeout. Not that I can think of anything.
I don't want to take all that time if there is a common reason why this might happen that someone could point me to.
Thank you.

Socket.io client connection to second server

I have a .NET app that is serving up an Angular 1.4 app. I'm running a second Angular app in the nav bar that connects to a second server running Node.js and Socket.io.
I can connect to the the client to the server when I'm running the server on my localhost via
io.connect('http://localhost:8080')
but not when I'm trying to connect to my Heroku instance via
io.connect('http://my-weird-heroku-generated-url.com').
Is this because I'm not specifying the heroku port? Do I need to use the unaliased numeric IP address to my Heroku app (similar to the 127.0.0.1:8080 address/port to my localhost)?

App engine dev server through LAN. Cloud storage bug

To access the dev server through LAN, we set the --host to 0.0.0.0 as mentioned i the post Is there any way to access GAE dev app server in the local network?. But if i upload a file with this settings, I am not able to access the image (through image serving url by blob_key) as it is uploaded to 0.0.0.0 and not 127.0.0.1 (local host). Can anyone suggest a solution for it?

Stop Dev app server in windows?

How to stop Dev app server in windows when I am trying to run my GAE as a web application on local server it shows port in use and giving error.

Resources