Search code examples
singlepageampersand.js

Ampersand.js admin panel makes it a 2 page app?


Ampersand being a single page application framework, would I begin messing things up by creating a separate page that will have just about as equal amount of functionality not even necessarily related to the visitor page (small business application that may wish to have additional management related features)?


Solution

  • Well, as always, it depends. Basically, if your admin pages don't add much overhead to the size of your app, then you can keep it a SPA. The most "heavy" parts are likely to be different libraries that you use. And if those libraries are the same both for admin and for simple users, then your own views and stuff will not really add much (especially if you are minifying and gzipping everything, and you should). But if you use, let's say, a tinymce + full lodash + ... for the admin purposes, while you don't for normal visitors, then possibly you should put it in two separate apps since you don't want your visitors to load extra 300kb.

    From the security point of view it should not be a problem since all the requests to your API should be checked server-side. So even if somebody gets access to the admin views they should be unable to get or post anything they don't have rights for.

    P.S. As browserifying can take a while, I really recommend you using the watch option if you are not doing it yet, it will really speed up the compilation when you change code