We are building a fully RESTful back-end with the Play Framework. We are also building a separate web front-end with a different technology stack that will call the RESTful API.
How do we deploy both apps so they have the same domain name, with some URLs used for the backend API and some for the front-end views?
For example, visiting MyDomain.example
means the front-end displays the home page, but sending a GET to MyDomain.example/product/24
means the back-end returns a JSON object with the product information. A further possibility is if a web browser views MyDomain.example/product/24
, then the front-end displays an HTML page, and that webpage was built from a back-end call to the same URL.
Finally, do we need two dedicated servers for this? Or can the front-end and back-end be deployed on the same server (e.g. OpenShift, Heroku)
GET
toMyDomain.com/product/24
that should return a response from your frontend and one that should return a response from your backend? Do you require your backend users to add a special HTTP header? A specific User-Agent?