Do I share the FrontEnd and Backend?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
57 views
Will try to explain my problem as accurately as possible.

So, I have a website. In this separate structure, BackEnd and FrontEnd
For the FrontEnd separate server for the backend is also a separate, let's call them conditionally front.domain.com and back.domain.com. Here I say, I may not correctly divide the Front and Back, with a cross-server structure I'm working for the first time, this possible error is allowed in the "Foundation" of the project.

To check, right?
1. On the server ForntEnd - drawing the pages, but not by the means of JS and PHP. Why - please stipulate below, it is perhaps not true
2. On the server BackEnd to retrieve data from the selected functions, e.g. obtaining the count of subscribers
3. After going to the link: for example domain.com/catalog loaded the page, all dynamic values inserted there by means of PHP, then the transition through the pages of the website just loads the content into the block, so with all the links.

Finally, the question itself
In fact, it would be all on 1 server, ie, BackEnd and FrontEnd - I could file catalog.php just plug the file API of the website require("api.php"). But I like this, I want on different servers ForntEnd and BackEnd. Okay, from the position you can go to write all API code in the ForntEnd, but what is it then ForntEnd if he pulls data from database)) because Of this, I questioned whether I share these two components.

I know that the front is roughly what is processed on the client. I can do everything in JS, but then how to do redirections without reloading the page? at the same time, to remain still and dynamic resource reference
by | 57 views

3 Answers

0 like 0 dislike
You have a problem with definitions:
frontend - everything works on the client side, that is, html markup, css styles, javascript.
backend the backend is responsible for receiving/processing/return data, including the generation of the html if necessary.

Specifically in your case all that is written in php, backend, whatever task it was not performed.
As for splitting servers, then all is simple: implement one api(just read about the REST), which is responsible for processing the data(model and business logic), the second implement routing and the generation of the frontend part(the view), which has to work with the api. But I would give up dynamic generation of php, in favor of a static front working with the api directly via js.
by
0 like 0 dislike
One approach not, you have specific tasks for them podbiraet the solution (the architecture), it is possible to continuously prepare the frontend to the backend, you can give a pre-prepared front-end (HTML or JS file to the user) which then will collect in a browser a more sophisticated type of product.
==
You just need to determine how would exchange data between frontend and backend usually use JSON format (optional).
Now often extended the scheme in which - JS scripts in the browser client is loaded from the backend only JSON data and display this data in more complex forms directly in the browser.
PS
logic redirects, and any such routing can be written in the frontend, intercepting user requests and specific manner, their processing by requesting the necessary data with backend through API.
by
0 like 0 dislike
I know that the front is roughly what is processed on the client. I can do everything in JS, but then how to do redirections without reloading the page? at the same time, to remain still and dynamic resource reference
But with this, it was necessary to begin, and to finish your question! Everything else is meaningless.

HTML5 history API: a short article on how it can be done.
by

Related questions

0 like 0 dislike
5 answers
0 like 0 dislike
2 answers
asked Apr 9, 2019 by Mr_Vazovsky
110,608 questions
257,186 answers
0 comments
35,390 users