Running a public Vapor Server from your MacBook
I’m doing a lot of server side Swift lately — primarily working on my Slackbot Chameleon. I am working on a new feature that requires a HTTP server and I’ve decided to use Vapor. The problem is when trying to debug locally I was unable to expose my macbook builds in a way that is publicly visible to the internet.
It seemed like the only solution would be to deploy each time I wanted to test… which would be fine but you don’t have access to breakpoints for example.
Then I came across a tool called LocalTunnel. Once you run it it will give you an external url that you can use to access your machine and the listening Vapor instance, no additional config is required for Vapor either!
To install all you need to do is (node.js required):
npm install -g localtunnel
Then to start the tunnel:
lt --port 8080
And that’s it!
I highly recommend using this if you are doing any work with Vapor — it makes the development cycle much easier.