Testing Locally Hosted Site on Phone

I’ve been building a Rails app with mobile, tablet, and desktop views using Materialize CSS and wanted to be able to test the site on my Android phone to make sure sizing and touchscreen links are user-friendly.

Localhost.run turned out to be a quick solution. After running an app on port 8080, you can run Localhost’s command and get a url to view the site from another device for preview and testing.

For a Rails app, start the server on port 8080.

rails s -p 8080

Then, run Localhosts’ command in another Terminal window.

ssh -R 80:localhost:8080 -p 2222 ssh.localhost.run

LocalHost will print the url to visit in Terminal.



JS Questions: What is Express?

This is the thirteenth in a series of posts I’m writing that aims to provide concise, understandable answers to JavaScript-related questions, helping me better understand both foundational concepts and the changing landscape of language updates, frameworks, testing tools, etc.

What is Express?

The backend framework Express, released in 2010 and supported by Node.js, can be used to handle routing, generate ‘views’ for request responses, and define an application’s basic specifications. Express can be used with any database that Node supports, such as MongoDB, PostgreSQL, and Redis (though it’s not necessary to use a database with Express).

The following code creates a server without using Express. The server runs on port 3000, allowing a user to go to “localhost:3000/” and see the string “Hello World!”.

This illustrates that it’s not necessary to use Express to employ Node’s HTTP request response cycle. However, Express makes it easier to define routes and set up some basic specifications for an app. After installing Express, the following code should also render “Hello World!” at “localhost:3000/”:

Express’s website describes the framework as “fast, unopinionated, minimalist,” because its simply a layer on top on Node.js that allows developers use any file structure, pattern, or additional middleware they choose. This makes it easy to build simple applications without unnecessary bulk.

Express is used in production by some high profile companies (Uber, IBM, MuleSoft, to name a few) and is a part of the JavaScript stacks MEAN (Mongo, Express, Angular, Node) and MERN (Mongo, Express, React, Node).