loading...

How to start to code a PWA?

philnickel profile image Phil ・1 min read

Hey guys,

I must code my first app. So I think PWA is interesting to get a cross plattform app for our company.

I need a connection to my mySQL database to store our data and when the user use the app offline data must stored local.

Is this possible with any plattform? Which is easy to use?

Thanks :)

Discussion

markdown guide
 

Hey there!

You can cache data in your app using Service workers and IndexedDB

You'll need a service worker if you want your app to be available offline (as a PWA), I suggest you check out Workbox, it'll get you started and there's plenty of docs for you to read!

 

Is it easy to use with mysql or not ?

 

I’ve never tried connecting to a database directly from a web page, but if it’s similar to going through an API then yes. You can save requests responses in the browser cache at runtime.

I don't know about MySQL (can't say I've worked with it or even wanted to work with it), but I've just written a post on the disaster that is setting up a PWA that should also work offline and including a manifest.JSON file for that purpose.

dev.to/desolosubhumus/offline-pwas...

In the end, I ditched the whole PWA bit of the process and released the thing as an uninstallable app with a desktop icon to be used for a desktop shortcut to the index.html page. It breaks use for mobile (although anyone is welcome to modify the app locally or send a pull request/issue if they know how to fix that), but at least it's not breaking desktop use, too.