Public URL for your nodejs web application

Let’s assume you have a nodejs web application that runs in your personal laptop or in a server in your office LAN network.

Anyone outside of your office network cannot access the web application because the application runs in your local network.

Suppose you want to expose the web application to the internet, so that your customers or remote employees can access it from anywhere in the world.

Today, there are two ways to expose your application to the internet.

  • Deploy the web application in your office server which has a public IP address and domain name.
  • Deploy the web application in the cloud such as AWS, MS Azure, GCP or web hosting companies like GoDaddy, SiteGround, A2Hosting etc.

Both of the above options cost more money in terms of purchasing your own IP address, domain name, configuring and managing them. Moreover, you need to pay the monthly usage based fees if you run the web application in any cloud server.

To address the above problems and provide an alternate cost-effective solution, we have created SocketXP.

SocketXP is a simple, quick and cost-effective way to deploy your web application online.

How it works?

  • Run your web application in any server or laptop in your office LAN network.
  • Download SocketXP Client and install in the office server or laptop
  • SocketXP Client will create a secure tunnel from your server to the SocketXP Cloud Service.
  • SocketXP Cloud Service will provide a public tunnel endpoint (Public IP address and port) that you can use to access your nodejs web application from the internet.

A Quick Demo:

Let’s use the following simple nodejs web application for the demo.

$ cat myapp.js
var http = require('http');

//create a server object:
http.createServer(function (req, res) {
 res.writeHead(200, {'Content-Type': 'text/html'});
 res.write("<h2>Hello World!</h2>"); //write a response to the client
 res.end(); //end the response
}).listen(3000); //the server object listens on port 3000
$

Run the myapp.js on a local server or laptop.

$ node myapp.js

Using a browser, let’s point to http://localhost:3000 to connect to the web application.

Right now the web application can be accessed only by you because it runs on your laptop.

Now to make the nodejs web application accessible from the internet, let’s download and run the SocketXP Client.

Go to https://portal.socketxp.com. Sign up and create an account for you.

After you login, click the “Client Download” tab on the side navigation bar.

Select the operating system in the tab on the right hand side, and click the copy button, to copy the command to download the SocketXP for your OS type.

Paste the command in a new terminal window in your laptop or server where the nodejs web application is running. The command will download and install SocketXP client on your laptop.

$ curl -O https://portal.socketxp.com/download/linux/socketxp && chmod +wx socketxp && sudo mv socketxp /usr/local/bin

Now authenticate and register the SocketXP Client with the SocketXP Cloud Gateway, using the auth-token from the portal.socketxp.com.

Click the copy button to copy the command string and paste in the terminal window in your laptop or server.

$ socketxp login "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1NTA3MzgwMjEsImlkIjoiZ2FuZXNodmVsqerdfadf24342348700adfDD.QDAFERadfasdfjad234234aJdfqwefrlkD"

After registering the SocketXP Client with the SocketXP Cloud Service, you can start creating HTTP proxy tunnel or TCP proxy tunnel between the application running in your laptop and the SocketXP Cloud Service, via the SocketXP Client.

As our nodejs app is a web application(HTTP server), let’s create a HTTP proxy tunnel. Use the following command to create a HTTP proxy tunnel between the nodejs web application and the SocketXP Cloud Service.

$socketxp connect http://localhost:3000
Public URL -> https://679aa48b-1162-44f7-b6c6-59129dd68b58.socketxp.com

Let’s access the nodejs web application from the internet using the SocketXP Public URL provided in the above output.

You could now share the above link to your customers or remote employees, so that they could access your web application from anywhere in the world.  Use SocketXP service to quickly share your website or web app under development (Work In Progress) with your co-workers, managers, or your customers.

The above SocketXP public URL is a permanent link just assigned to you and it doesn’t change until you delete it manually from our server using the “socketxp tunnel rm”  command.

SocketXP online service has a free tier with basic features and paid subscription plans with premium features.  Ask for developer discount, if you are a freelance developer in need of our service.

You can reach us at support@socketxp.com for any questions or sales queries.


Typical Use Cases for SocketXP

Website Hosting

You can follow the same set of steps, shown above, to expose your local web server to the internet. This way you can avoid paying website hosting fees, domain name fees etc.

Demo your work in progress

You can use SocketXP to quickly show a demo of your website or web application under development in your laptop, without having to deploy your webpages in a public web server. Your customers or managers can get a quick real-time hands-on experience with the website or web app, and suggest improvements.

Customers demo software bugs

Customers testing a web application in a lab setup, before deploying it in a production server, may find software bugs or configuration related problems. Customers could use SocketXP to share the instance of the web application running in their local lab setup with the software vendor’s technical support team. The technical support team can take a look at the customer reported problem, debug the issue and suggest any possible solution to the software problem.

Hackathon Demo

SocketXP can also be used to demo your web application developed in your laptop, to online judges during hackathon and other online programming events.

 

 

You may also like...

Popular Posts