![Progressive Web Application Development by Example](https://wfqqreader-1252317822.image.myqcloud.com/cover/668/36699668/b_36699668.jpg)
The application's code structure
Let's review how the game's source code is structured. I like this project because the code is simple and demonstrates how much can be accomplished with a small amount of code in the browser.
There are three asset folders: js, meta, and style. They contain JavaScript files, images, and style sheets that are needed to render and execute the game.
You will also notice a node_modules folder. I added a local web server using grunt connect, which is a node module. The original game works just fine if you load the index.html file directly in the browser. However, due to security constraints, a service worker does not function without a web server. I will cover this in more detail shortly.
At the root-level, there are only handful of web application files:
- index.html
- manifest.json
- sw.js
- favicon.ico
The nice thing about the 2048 code is that it only requires a single HTML file. The manifest.json and sw.js files add the PWA functionality we are after. The favicon.ico file is the icon loaded by the browser for the address bar:
![](https://epubservercos.yuewen.com/A4C68F/19470391301554106/epubprivate/OEBPS/Images/8d02b826-e07d-4f12-b227-020828193b96.png?sign=1739287615-ZgCPgya65lV7DBPVZpca67Dfbr0anjQK-0-2fab91378df9434b870e1225d4df6752)