I made a simple API using Loopback.It works fine and give the result below from this URL. http://localhost:3000/api/CoffeeShops
[
  {
    "name": "Coffee shop 1",
    "city": "City one",
    "id": 1
  }
]
I need to change this JSON to this template, By using Loopback middleware.
{
  "_embedded": {
    "CoffeeShops": [
      {
        "name": "Coffee shop 1",
        "city": "City one",
        "_links": {
          "self": {
            "href": "http://localhost:3000/CoffeeShops/1"
          },
          "CoffeeShop": {
            "href": "http://localhost:3000/CoffeeShops/1"
          }
        }
      }
   ]
   }
}
				
                        
Better yet than a middleware, you can use a remote hook
The following code inside
coffee-shop.jswill do the trick