Convert ionic app into browser page


#1

I have an Ionic 2 app running on mobile devices.
It connects to the server powered by node.js.

Now, my task is to build a web platform, that has functionality
similar to the app, but with more features:

  • Bigger and more advanced analytics
  • file uploading to the server, etc.

I ask myself if I there is a way to extend ionic2 app code
with this functionality and server from my server.
Or I am better off going with a new Angular implementation
from scratch.

Any thoughts or pointers are very welcome!


#2

The biggest thing to decide is whether you are happy with the UX of Ionic on a desktop browser. If so, then yes it is simple to extend it with pages (or parts of pages) that display only on desktop browsers using the Platform feature.


#3

I’m currently going through an exercise building a large enterprise PR application.
With angular’s nice separation of concerns I am keeping stuff like database interaction and business logic in a shared layer between an ionic front end and an angular/bootstrap front end.

Then I have a large code share with a thin UI layer, so minimal repeat code.


#4

Thanks for the answers!

UX of Ionic on a desktop is fine.

And how do you do it from the code organization perpective?
Is it one big project, that has both desktop and ionic inside?
Do you also use ionic serve for the desktop part + run the backend server?

or it’s two different code bases, that have a shared module?


#5

Big project I would say.

For running the web server I’d say you need a proper web server, apache / nginx / iis…

The contents can be created from…

ionic build browser --prod

The www folder produced is what needs to go onto your server.


#6

Single code base that doesn’t generally care whether it’s on device or browser.

No; I only use ionic serve during development. For deployment, I package nginx up into part of a docker-compose cluster that also typically contains an application server and a postgres.


#7

I’d be interested to learn more about that process of using this within a docker…


#8

Thanks a lot! It’s all clear now.
Will give it a try!


#9

Here’s the docker-compose overview. It allows you to have a bunch of containers communicating across a private network. I guess that’s not very cool for the Ionic side of things, but it sure does make having the nginx frontend, app server, and database talking to one another really easy. The web apps can just live in a subdirectory of /usr/share/nginx/html in the nginx container.


#10

Just to answer my question, in Ionic’s latest newsletter :slight_smile: