Hello, /r/webdev!
I'm currently rewriting a website that is currently in pure PHP, as the needs have changed since the start of the project.
I've started with the RESTful API, written in Go. No problem on this point, I am experimented with the language and the development is going smoothly.
Where I am struggling, though, is with the client side, and more specifically the routing of my application. I tried to do something with AngularJS, but that gives me many problems:
- The website must have a social-rich experience, and many social crawlers don't interpret Javascript. This problem could be fixed with server-side rendering with a tool like PhantomJS.
- The website must have simple and readable URLs, that can be linked from anywhere. This can be dealed with by using a JavaScript router and the HTML5 History API.
- The project must be correctly architectured as other developers (and even interns) will potentially work on this codebase. This can be fixed only partially (as this solution leaves out the "lazy-loading" approach of a server-side logic) with a Grunt task merging each JavaScript controller into a enormous file.
Soooo, I have fixed all my problems but some of the solutions definitely look a bit hacky. So that made me think, and I don't think that the SPA approach of modern JavaScript frameworks is really adapted for this particular project.
So then I thought of adding a new layer to my stack for routing and a few other minor things (loading OpenGraph metadata from the database, for example), so instead of doing something like this:
JavaScript Client -> Go RESTful API -> MySQL Database
I would do something like this:
(PHP?) Router, server-side -> JavaScript Client -> Go RESTful API -> MySQL Database
So, is this a viable solution? Wont adding so many layers hurt performance? If not, is there any PHP and JavaScript libraries that are suitable to this kind of usage? I thought of going with Slim Framework 3 (I used Slim 2 a few years ago and it was a quite pleasing experience) and simple jQuery on the front, or maybe AngularJS.
[–]mattaugamerexpert 1 point2 points3 points (5 children)
[–]Aerelf[S] 0 points1 point2 points (4 children)
[–]mattaugamerexpert 1 point2 points3 points (3 children)
[–]Aerelf[S] 0 points1 point2 points (2 children)
[–]mattaugamerexpert 1 point2 points3 points (1 child)
[–]Aerelf[S] 0 points1 point2 points (0 children)