We can modify incoming data to twig using Drupal 8 template hooks but we also need some quick filter and dynamic functions that we can directly inject to a particular template.
Drupal 8 provides a way to create custom twig extension, Let’s how we can do this.
One of the important features that are inspired by drupal 7 and imported to Drupal 8 with enhancement is its REST API. Drupal provides inbuilt Rest support for exposing entities and creating new entities. You can view all those Rest endpoints by installing the rest_ui module. However, sometimes we also need to define custom Rest Resources / Endpoints for our custom requirement.
So here is how we can define custom Rest Resources.