How to serve a cordova SPA via Wappler

Hi all,
Looking for a bit of help here. I’ve developed a few mobile apps in the past, so I know hybrid apps (SPAs) can use Angular (in my case) to render route-based pages. But I’ve normally served the apps via ‘ionic serve’.

In the case of Wappler, I’ve create a SPA with two demo pages, in a project with no server-side components. Routing is enabled for the project.

But when I add routing components and point them to the sub-pages, I can’t get them to render in the browser when I’m running a simple node-based http server.

I’ve seen the SPA docker example, but unfortunately, I can’t run docker on this machine.

I’ve no back-end set up in wappler, as the mobile won’t have PHP, Node, etc, so I’m assuming Cordova/Phonegap has some sort of routing component/server/black magic that handles the routing.

But I’ve got no idea how to replicate that on my local PC.

Has anyone got routing working on a desktop like this, and can point me in the right direction?

Regards,
Andy

I’ve made a tiny bit of progress. If I point my browser to http://localhost:12345/, I get an error saying “File C:\Users\andre\Documents<project folder>\www not found.”

But if I go to http://localhost:12345/index.htm, I get the full home page and the view that’s rendered on the / route. Thumbs up for that.

However, that then has a button which should redirect to the second view. That does actually load the second view in the background, as I can see it in chrome dev tools. But it’s not rendered - the browser stays on the home page including the default “/” view.

Sigh.

Ah, I just tested the docker for windows install, and it works, so I’ll be able to take it from there.

1 Like

Will be interested to hear how you get on Blakey as we are about to begin the process of converting a lot of our services and applications over to Docker including the mobile applications (which will all get the SPA treatment)… Please keep us updated mate.

Cheers!