4 ms·
Just out of curiosity, if the API is already being built in Java, why not just build a single-page-app to utilize the API instead of Django? I'd assume the depl
by Kpourdeilami 9y ago
Just out of curiosity, if the API is already being built in Java, why not just build a single-page-app to utilize the API instead of Django? I'd assume the deployment and overhead of maintaining a single-page-app would be way lower than Django. (i.e. uploading to s3 and setting up CDN vs. setting up a VM for Django with nginx, uwsgi, etc.)
- Scarbutt 9y agoDepending on the app, writing a SPA could be a lot of work vs just writing your UI as a frontend server. About NGINX, is still needed in both cases IMO, for the API or the frontend server.
- richardknop 9y agoOne reason would be because you don’t know react or angular or whatever the latest js framework is. You have known Django for a decade and it still works so why waste time learning some js framework which might be out of fashion in 2 years. Generate dynamic HTML on the server, that still works just fine. And codebase will be way simpler as you just generate HTML on page refresh. No need to fiddle with event listeners and DOM and AJAX or whatever. Single page web apps are often wrong choice if you just need some UI other than some fancy dashboard. Let’s say you need an admin panel where you can do CRUD operations, that’s perfect for Django/Rails and would be much much more work as SPA.
- mythrwy 9y agoStatic pages and full refreshes really limit what a page can do though. My personal preference (for most use cases) is a combination. Some things are easier done in static templates but JS is needed to really bring a page to life IMOP. Lately there is too much SP-appage around where there are simpler alternatives though, with that I'll agree. I guess it keeps people employed screwing around with webpack so there's that.
- richardknop 9y ago> Static pages and full refreshes really limit what a page can do though. Yes. But for 90% of business UI cases, you have some sort of collection of pages (i.e. website = collection of pages not a single page with everything crammed into it) with navigation menu. You use the menu to navigate to different pages with HTML forms that submit POST data and do GET redirects. Trying to cram an entire business logic into a single page is often detrimental, split it into multiple pages. Highly interactive apps that fit into a single page model is maybe 10% of use cases or less I have seen in my career last few years. This is all just my opinion obviously but I just think SPAs are a fad that will hopefully go away.
- boundlessdreamz 9y agoI have never written an SPA but after writing a fairly complex ecommerce admin backend (handling orders, shipping etc), I wish I had. There are a lot of complex UI state and some of it would have been easier in React/Vue
- sgt 9y agoAs someone already suggested, writing an SPA comes with a lot of work to get going. This is a side project I need to write, and then hand off to an external development team at some point. Then it helps to simplify the equation as much as possible.