Which view into which protocol?

Guys as an integrated view it follows which protocol? Because the REST API the view is separate and the integrated view that uses as extensions .ejs, .pug, .njk and etc. What does she wear? SOAP?

Hello and Welcome :slight_smile:!

Could You explain what do you mean by which protocol and What does she wear?

SOAP is a format, just like JSON or XML. The views are not related to a REST API, since one of the purposes of it is to separate the data representation from how the data is handled. Usually, a REST API is capable of answering with JSON, XML or YAML by simply appending a .(json|xml|yaml) to the end of the URL:

/api/v1/endpoint.json # Would return the data as JSON
/api/v1/endpoint.xml # Would return the data as XML
/api/v1/endpoint.yaml # Would return the data as YAML

The fact that a server can return views is not related to the REST API concept. express can return views, but it can also be used to create REST API.

That said, I may have misunderstood the question :stuck_out_tongue:

What you’re talking about has nothing to do with protocols, they’re just ways of generating HTML using JavaScript. You have a library that runs a function that looks for files of some specific file type and replaces stuff in them with data you provide, then returns HTML.

REST says that each resource should have it’s own identifier (eg a uri). That resource could be anything, but assuming you have a node server application, the views generated here using one of those templating languages would be HTML, so the resources at the endpoints would be HTML files.

1 Like