1

I am developing a web app that has a sign in page for signing in. But also, for example, there is a public page for facebook sharing page.

If a user wants to go into the panel, url is:

http://127.0.0.1:3000/#/shops/:id/

If someone makes a Facebook share, we have a public page like:

http://127.0.0.1:3000/#/public/56af5229d0ae74e324c662f9

My problem is, I have 1 index.html for this app, and it includes css, js links and a ui-view for ui-router. For public page, all those unnecessary files are loaded.

In index page, I have:

<div ng-if="isPublic()" ng-include="'views/public.base.html'"></div>

Also, I cannot control the meta tags of the page.

How you can handle separation of pages in such a case?

Burak
  • 5,706
  • 20
  • 70
  • 110
  • If you have to develop a private part, do it in another application, with a limited access (authentication on a login form not in angularjs, which sends the app js and html only if your credentials are right). An example is the administration of a website, it has to be separated, and you have to avoid the .js code to be caught else anyone can parse the code to find the URIs of your API. – Pierre Emmanuel Lallemant Feb 05 '16 at 09:36

1 Answers1

0

I have a site with public/private parts, but I took a different approach in terms of resources. I did not separate them since it would be just to much work, instead I did this:

  1. Minification
  2. Bundling
  3. Pre-compressing
  4. Caching-forever with the hash-string
  5. Putting all the html templates in a js bundle

Yes, this will make all the js/css that is not needed for everyone to load, but you can think of this as a standalone application: you have to download the whole executable/package and install it but you don't use all the functionality (e.g. think of Office). If you optimize all as much as possible, the few additional kilobytes won't do any difference and the data will be already there when the user logs on to private part.

P.S You can see how to do some of the points in here.

Community
  • 1
  • 1
Ilya Chernomordik
  • 27,817
  • 27
  • 121
  • 207