3 ms·
I do think that sometimes you just need a simple static website and then don't need an SPA. I think SPAs are good when you have to handle a lot of dynamic data
by cryptica 7y ago
I do think that sometimes you just need a simple static website and then don't need an SPA.
I think SPAs are good when you have to handle a lot of dynamic data. Especially realtime data.
I built a sample SPA with VueJS, Asyngular and RethinkDB to demo how easy it is.
It's a relatively complex app where all the views update in realtime but all the server code is less than 300 lines.
The framework does most of the work; on the back end, all you need to do is define the data schema and access control rules on the server side. See https://github.com/SocketCluster/ag-crud-sample/blob/6805499f5e8b241632a703dd1f26eb99b2120872/server.js#L80-L148 https://github.com/SocketCluster/ag-crud-sample/blob/6805499...
For the front end, I use VueJS in the simplest possible way without any build step during development. I just define my main app component and setup a component for each page: https://github.com/SocketCluster/ag-crud-sample/blob/master/public/app-inventory.js https://github.com/SocketCluster/ag-crud-sample/blob/master/...
For data, I just use my own model and collection components to bind to the server data in real-time: https://github.com/SocketCluster/ag-crud-sample/blob/master/public/pages/page-category-details.js#L17-L26 https://github.com/SocketCluster/ag-crud-sample/blob/master/...
The collection component lets you bind to a 'view' which is declared in the schema on the server.
It's just CRUD with realtime subscriptions built into the model and collection objects, nothing special.
You can achieve a lot more if you just keep things simple (at least conceptually) and use the right tools.