Yehia A.Salam
Yehia A.Salam

Reputation: 2028

Ionic Desktop Testing

Is there any advantage in testing the ionic app on a web browser using the the ionic serve command vs just running a local apache server and browsing the www folder (e.g. http://localhost/www/#/app/home). I checked the serve.js file in the npm module and apparently all it does is listening for a tcp connection on a default port using nodejs modules.

Upvotes: 0

Views: 600

Answers (1)

Jeremy Wilken
Jeremy Wilken

Reputation: 6974

There are a few advantages, but you are certainly able to use a local apache server as well.

ionic serve benefits

  • It runs with the ability to have live reload, meaning if you save a file in your editor the app will auto-refresh in your browser. You can disable by with the -r flag on the command.
  • It can open a browser when you start up, which can be nice or annoying. You can disable with the -b flag on the command.
  • It sets up a local server for you, regardless if your files are in the apache www directory. It lets you store the files anywhere in your system.

Apache benefits

  • You can setup .htaccess rules to rewrite urls to properly support html5mode in Angular. I don't do this on mobile apps since the urls are not available in apps.
  • Runs on port 80. You don't have to worry about ports or remembering what port to use.

Its up to you really, but I use ionic serve. You can also use cordova serve which does the same as ionic serve without live reload and browser open, and runs on localhost:8000.

Upvotes: 1

Related Questions