Localtunnel Localhost Server Expose Problem. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Localtunnel Localhost Server Expose Problem.

Hello everyone... I made a localhost server yesterday which would display an HTML website in local server. Here's the code below ################################# var http = require('http'); var fs = require('fs'); http.createServer(function (req, res) {   fs.readFile('mywebsite.html', function(err, data) {     res.writeHead(200, {'Content-Type': 'text/html'});     res.write(data);     res.end();   }); }).listen(8080); ################################ Now I want to expose it using localtunnel. Step 1: I open 2 command windows Step 2: Start the localhost from a window And install the localtunnel using code below in another cmd window npm install -g localtunnel Step 3: Whenever I try exposing my server writing the code in the 2nd cmd window lt --port 8080 It takes longer time than usual to generate global website url. So long that appear negative sign to me. So, are my steps wrong or something is wrong with my computer. Thanks for your precious time.

16th Apr 2020, 6:53 AM
[B.S.] BITTU
[B.S.] BITTU - avatar
13 Answers
+ 1
got stuck just like you try heroku with mongodb atlas
16th Apr 2020, 11:52 PM
Gordon
Gordon - avatar
+ 4
oh i should have told you what i got. actually i started a screen recording session, hoping to share with you my results via my YouTube channel. I get the same result as you. No result for lt --port PORT_NUMBER and only npx : installed 35 in 79s for the Quick Start npx command After recording for 20 minutes, I stopped and deleted the video. i didn't get any results after waiting. So I dug through the Issues (#343, #340, etc. ) and suggest you to use alternatives. Can I know your purpose for using localtunnel? If you want to see results of every changes you made once saved, you can use nodemon (npm) or live server (VS Code). If you want to check responsiveness of web design, you can use DevTools. If you want to deploy your backend to public, best way is heroku.
16th Apr 2020, 4:26 PM
Gordon
Gordon - avatar
+ 3
I just tried localtunnel, it's just that they are slow. and I checked the Issues in their Github pages, there are many complaints about its speed. https://github.com/localtunnel/localtunnel/issues/343 https://github.com/localtunnel/localtunnel/issues/340 Also, this module is not maintained, the last update is 7 months ago https://www.npmjs.com/package/localtunnel Try ngrok instead. https://ngrok.com/
16th Apr 2020, 1:27 PM
Gordon
Gordon - avatar
+ 3
hm... so your server accept applications? Where are the enrollment data stored? Your local data server on your computer?
16th Apr 2020, 4:36 PM
Gordon
Gordon - avatar
+ 3
I'm not sure if you realize this, but it appears that the https://localtunnel.me/ server is no longer running. Therefore, the localtunnel client is stuck trying to connect to a server that's offline. You'll need to find another service.
16th Apr 2020, 5:37 PM
David Carroll
David Carroll - avatar
+ 2
Gordon hmm.. otherwise some other projects David Carroll ok thanks.
16th Apr 2020, 5:39 PM
[B.S.] BITTU
[B.S.] BITTU - avatar
+ 2
Gordon did u even be able to get URL from the code, how much time did it take? lt --port 8000 Or it got stuck just like me. I also guess that the service has been stopped according to David Carroll
16th Apr 2020, 5:43 PM
[B.S.] BITTU
[B.S.] BITTU - avatar
+ 1
thanks for mentioning i havn't used localtunnel before i just checked the official doc, which says to get started, run npx localtunnel --port 8000 (source : https://github.com/localtunnel/localtunnel ) have you run this command? edit : i expanded the readme npm i -g is ok and next it suggests to use port 8000 instead of 8080 Can you try using port 8000?
16th Apr 2020, 10:17 AM
Gordon
Gordon - avatar
0
Gordon hello can u answer this
16th Apr 2020, 8:59 AM
[B.S.] BITTU
[B.S.] BITTU - avatar
0
Gordon npx localtunnel --port 8000 does not seem to be working it's output is also strange, except printing the url it prints the following in console. output: npx: installed 35 in 8.625s after printing above... a long pause again.....
16th Apr 2020, 11:32 AM
[B.S.] BITTU
[B.S.] BITTU - avatar
0
Gordon i know about ngrok but won't use it because it's a paid application. So that means I have to wait a long pause if I keep using localtunnel?
16th Apr 2020, 2:32 PM
[B.S.] BITTU
[B.S.] BITTU - avatar
0
Code Crasher i already made myself sure that none of other operations are running on the same port according to Gordon it seems quite slow. And I am using Win 8
16th Apr 2020, 2:34 PM
[B.S.] BITTU
[B.S.] BITTU - avatar
0
Gordon gaming purpose PUBG competition enroll and championship etc etc
16th Apr 2020, 4:28 PM
[B.S.] BITTU
[B.S.] BITTU - avatar