Should I submit the full webpage as html / text for the rest?

I am creating a website that will serve dynamic content. All communication between server / browser through REST. PostgreSQL is used as a data warehouse.

My question is for any GET request, should I create html on the fly (along with dynamic content).

As an example

@GET
@Produces(MediaType.TEXT_HTML)
public String getAllEmployee() {
    // employees fetched from the data base
    String html = "<HTML></head> blah blah";
    return html;
}

My question is whether html should be created on the fly and sent back to the browser. Also how do big websites like linkedin work? Do they create an html page on the fly and submit the page?

Another way I could think of is to send hbbbbb with an AJAX request built into it. And then the ajax request retrieves the dynamic content from the server.

+3
source share
2 answers

REST () , .

HTML, Accept. , JSON XML, - - , , URI .

, REST API . , HTTP- API, API .

+8

, REST , XML JSON. HTML . HTML ​​ ,

  • , API
  • , .
  • , , , , .

JSON , ( ) HTML.

+1

All Articles