DEV Community

Cover image for Expose localhost server to internet in 1 step
Tilak Madichetti
Tilak Madichetti

Posted on • Updated on

Expose localhost server to internet in 1 step

#Whotisupeverybodyhowisitgoing

After reading this article you will be able to deploy your app in 1 command *literally* (the setup is 5 steps though). So smash ALL of ❤️ 🔖 🛳 on your left and let's dive right in !

STEP 1 - Install PHP and Composer

MAC Users:

Just go

brew install composer
Enter fullscreen mode Exit fullscreen mode

Of course you need to have brew installed https://brew.sh/ - Its the best package manager of Mac OS

If you are on Windows,

use these links:

PHP build for Windows download - https://php.net

Composer Installation Instructions here - https://getcomposer.org/doc/00-intro.md

STEP 2 - Make Composer Install beyondCode/EXPOSE

composer global require beyondcode/expose
Enter fullscreen mode Exit fullscreen mode

Now add this to your .zshrc or .bashrc file based on whatever terminal you are using.

export PATH="$PATH:$HOME/.composer/vendor/bin"
Enter fullscreen mode Exit fullscreen mode

Then restart your terminal and type expose to see if the command is recognized or not.

STEP 3 - Go and get yourself one of these 🍺 , cuz I believe you completed the hardest part of the journey

STEP 4 - Now create an account on https://beyondco.de/ and you will be given a token so register that with your terminal

expose token [YOUR-AUTH-TOKEN]
Enter fullscreen mode Exit fullscreen mode

STEP 5 - This is the 1 line you've been waiting for ٩(^‿^)۶!

Here you go (☞゚ヮ゚)☞

expose share https://127.0.0.1:400 --subdomain="subd" --auth="admin:123"
Enter fullscreen mode Exit fullscreen mode

This will link your local dev server running at 127.0.0.1:400 to a url subd.sharedwithexpose.com which anybody on the internet can access with the credentials.

username: admin
password: 123
Enter fullscreen mode Exit fullscreen mode

You can customize the subdomain and auth credentials to whatever pleases you for free unlike https://ngrok.com

Resources referred

Official docs https://beyondco.de/docs/
Google

Hit the FOLLOW button for more awesome content

Top comments (8)

Collapse
 
amlana24 profile image
amlan

Yes..this doesnt seem legit..

Collapse
 
tilakmaddy_68 profile image
Tilak Madichetti

but the content is 100% accurate bruh

Collapse
 
tilakmaddy_68 profile image
Tilak Madichetti

😂😂😂 unfortunately this is required to encourage people to learn the actual stuff :(

Collapse
 
manishfoodtechs profile image
manish srivastava

Nice localhost forwarding method.

Collapse
 
bastianhilton profile image
Sebastian hilton

the question I have is how to keep this alive on windows even if i close the cmd

 
tilakmaddy_68 profile image
Tilak Madichetti

Changed it bruh

Collapse
 
tilakmaddy_68 profile image
Tilak Madichetti

....and don't forget to follow me on twitter where I keep posting more awesome stuff
@til20fifa14

Collapse
 
hrrarya profile image
Hridoy Mozumder

Wow, cool method.