I have purchased a subscription to NameCheap VPS service.
I have nodejs api running locally that I want to expose.
Currently when visiting mydomain.com a static page is served. How do I expose my nodejs api and handle requests to for example mydomain.com/books?
I have run the steps descrived here
The following guide is useless.
Related
I am new in reactjs and nodejs.I made an application with react frontend and express backend. There are axios post and get requests for get data from mssql database via express.
When the project in production level, I write the IPv4 address and port for access dashboard from another device in local network. After build,when I use for example localhost:5000 for requests, I can see all datas which are come from database in the device which react project running but with this I cant see datas from android phone in local network.
What should I do? Isn't there any other way than writing a static IP address? This project can be run different machines.
I am sorry for my spelling mistakes.
I just made a simple chat-service with Node JS and I want to publish It " Online " ; at the time I used Ngrok and Localtunnel , but they are very limited , therefore I saw Apache web Server but I have not found tutorial on how to use it.
Thanks and hope you can help me.
Ngrok and Localtunnel are services which let you open a connection from inside your network to an external server which then forwards traffic back down the tunnel so clients on the Internet can make requests to your service running inside your LAN.
Apache is HTTP server software. It is nothing like Ngrok and Localtunnel.
While you can set up a reverse proxy using it, for that to use useful in this use case you would have to install it in your router … and most routers don't let you install software on them.
You could possibly run it on a computer inside your LAN and then configure port forwarding on the router … but if you are going to do that then you might as well forget about Apache HTTPD and just forward traffic directly to the service you've written using Node.js.
There are security risks and bandwidth considerations to take into account when running services from your LAN. It's almost always a better idea to just invest in a proper hosting service like Amazon AWS, DigitalOcean Droplets, or Heroku.
By "online" I suppose you mean to host it globally. For that my friend you will be in need of a server (preferably a cloude server) and a static IP address. Both of these are provided by a lot of providers like aws, digitalocean etc as a platform as a service, which we can leverage. So pls do the following:
Register for a cloud service (aws, digitalocean, gcp etc.).
Create a server instance of an operating system of your choice (my pref would be a linux instance).
Attach a public static ip to the server.
Log into the server. (SSH is the most secure way and most providers provide this to log into your server).
Install dependencies (in your case NodeJS etc).
Make sure that the port in which the app is hosted is open publicly. Most providers provide a dashboard in which you can configure port settings.
Use Apache or Nginx for configuring a reverse proxy (this is just for keeping your environment secure)
Is it possible to publish to a GCP PubSub topic via a basic HTTP request? I have a Cloudflare worker from which I'd like to publish directly to a topic. I originally tried bundling the NodeJS module, but webpack (via wrangler) was unable to build due to dependencies (specifically tls) that are unavailable in the server worker environment.
It seems API keys aren't supported on the PubSub API and I can't for the life of me find a way to use a service account without using an SDK.
Sort of. There is the publish method that uses REST, but it requires OAuth2.0 authorization. I'm not sure if you'll run into the same issues as using the NodeJS client library, but if so, you'll have to use an intermediate service (i.e. Cloud Functions/Compute Engine/App Engine) that exposes an HTTP endpoint that can do the authentication for you.
For more information on using OAuth2.0, see this link here: https://cloud.google.com/pubsub/docs/authentication#user-accounts
I have deployed a web application in Heroku using node.js but within the application I need to make a request to an HTTP endpoint that returns a JSON file. While making the request, I get the a Mixed content error. I understand this happens because my application has been served through HTTPS but the request is HTTP. How could I tell heroku to serve my application as HTTP or what should I do to make it HTTP? Will this solve the problem?
Let's suppose a backend application, which exposes some Rest API, running on a Jetty webserver at address 192.168.1.10:8889.
I would like to have a frontend application (html/javascript only, on a apache2 webserver) running at the same IP but on a different port (e.g. 8000), which should consume the API exposed by the backend application.
How can i get this architecture working without get into "No 'Access-Control-Allow-Origin'" error?
I think that you should install a nginx proxy.
configure it as a reverse proxy you can see documentation here :
https://www.nginx.com/resources/admin-guide/reverse-proxy/
You can search on google for more specific documentation on what you want to do.