Powering a progressive web application
A lot of use cases for building web APIs are to power a progressive web application (PWA—also known as a single-page application, or SPA). Like many other web developers out there, the real draw to web development was for the purpose of building a usable application or website in the browser. Let's be honest, not many of us are out there writing curl
commands to use our favorite APIs. The real power of a web API is when it powers something else.
What does a PWA need in order to run? Well, when you build a PWA, the final product is a bunch of static files. Okay, so we put those files into a directory called ./public
and then we serve them:
app.static("/", "./public")
There you go—we now are running a PWA. We're finished.
Well, not so fast. Being able to serve the static content is important, but it is also not the only factor you need to consider. Let's look at some considerations when...