N
N
nepster-web2015-09-01 19:17:56
css
nepster-web, 2015-09-01 19:17:56

Will it be convenient to organize a PHP client for RestFull API (SPA)?

I read about this case in particular about the issue of SPA application, authorization and what to render backend'y?
For myself, I generally identified several disadvantages with the pure js + rest full approach:
- we lose the ability to work with cookies and sessions
- it's not very convenient and not familiar to work with JS MVC
- SEO optimization.
- everywhere you need to drag the token back and forth
. Actually, there are thoughts in this direction:
- RESTFULL api server (separate project)
- and we can write a client to it on any php framework in the classic form. The difference is that all the logic is in the api, and the models are only a request-response to the rest api.
It turns out there are no problems.
If anyone has experience with this, please explain. Guides are not interesting, it is your practical experience that is interesting.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
N
Nikolai, 2019-03-20
@Delta01

You can set it as the background of the entire section and position it in the corner, as an option

V
Vitaly Kuznetsov, 2019-03-20
@vitaly44

make a frame through the pseudo elements :before and :after
options how to make a mass :-) but you definitely need to do it through the use of pseudo elements

S
Sergey, 2015-09-01
@nepster-web

we lose the ability to work with cookies and sessions

Well, not really, you can still work with cookies and store sessions through cookies, another thing is that this is 99% unnecessary. And tokens - JWT solves all problems.
Get used to it, given that JS MVC is what MVC should be.
There are options here:
- Google's crawler supports JS now, the rest don't know about it.
- generation of snapshots (phantomjs for example) and Ajax crawling
- server-side rendering, relevant in the second paragraph.
Most frameworks make this transparent to the developer, so it's like pushing cookies back and forth.
Read about hexagonal architecture, for example. HTTP API and classic WEB UI are just two interfaces to the same logic that is encapsulated in services. The only difference is how the DTO from the service layer will be used to form the view (be it json or html).
https://www.youtube.com/watch?v=ajhqScWECMo - here you can watch at your leisure.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question