Skip to content

Get Started with Loophole!


Created Oct 10, 2020 – Last Updated Oct 10, 2020

Loophole

Aspire to expose your localhost to the Internet with minimal effort? Do you wish to avoid going through the tedious deployment process? Let me introduce you to Loophole.

Loophole

source : unsplash.com

#So, what’s Loophole?

In simple words, Loophole allows you to make your Web application public without actually deploying on a cloud service. It provides a user-friendly domain that you can share with your remote users/friends/teammates to try/use your WebApp.

#Let’s give it a try!

Firstly, create an account with Loophole . By creating an account, you get access to all the features loophole provides in its beta version. Next, download the latest version of Loophole here .

#Getting Started

In windows, click the loophole.zip file to unzip.

For Mac and Linux, use terminal with the following command:

bash
$ unzip /path/to/loophole.zip

#Authenticating Loophole CLI for all feature access

Once you’ve signed up, you need to configure loophole with the authtoken.with authtoken, you get access to account-only features. Loophole has a simple ‘account’ command to make this easy. Under the hood, the login command adds (or modify) the authtoken property in your loophole configuration file.

#Running our local server project

Meanwhile, we need to have a webapp running. Here we consider a simple gatsby server for representation purposes.

mywebsite.js
js
const os = require("os")
const express = require("express")
const port = process.env.PORT || 8000
const app = express()
app.get("/*", function (req, res) {
const hostname = os.hostname()
res.json({ hostname, version: "2" })
})

Now all we have to do is let Loophole know the port our local server is running on! After authentication, follow the below instructions:

Example - For an app running on port 3000, the command will be
bash
$loophole http 3000
# for 1.0.0-beta.8 and older
$ loophole 3000

and it fires a HTTPS secured tunnel for you.

Your website is now LIVE!

Share the URL with people you want to show your web application. It is that simple.

There are endless possibilities with Loophole. You can create a custom domain, or share a QR code than a URL. I would cover those features individually in other blog posts. For more details, you can refer to the documentation here.