DEV Community

loading...
Cover image for Expose localhost server to internet in 1 step

Expose localhost server to internet in 1 step

tilakmaddy_68 profile image Tilak Madichetti Updated on ・2 min read

#Whotisupeverybodyhowisitgoing

After reading this article you will be able to deploy your app in 1 line of 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

Discussion (10)

pic
Editor guide
Collapse
dko1905 profile image
Daniel Florescu

This article ticks all the click bait checkboxes:

CAPITALIZED tittle
"Must read now"
Girls in header picture

Collapse
amlana24 profile image
amlan

Yes..this doesnt seem legit..

Collapse
tilakmaddy_68 profile image
Tilak Madichetti Author

but the content is 100% accurate bruh

Thread Thread
dko1905 profile image
Daniel Florescu

If it is accurate, you should still not click bait.

Collapse
tilakmaddy_68 profile image
Tilak Madichetti Author

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

Collapse
dko1905 profile image
Daniel Florescu

If people find it interesting they would click it. A better tittle would be "Here is how you can forward localhost to the internet".

Thread Thread
tilakmaddy_68 profile image
Collapse
manishfoodtechs profile image
manish srivastava

Nice localhost forwarding method.

Collapse
hrrarya profile image
Hridoy Mozumder

Wow, cool method.

Collapse
tilakmaddy_68 profile image
Tilak Madichetti Author

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