Steps to Install Drupal Core
Installing Drupal 8 with Restful API

Installing Drupal 8 with Restful API

Drupal is a wonderful CMS that is used widely by many people. At regular intervals, Drupal introduces its updated versions. Recently, the new version of Drupal – Drupal 8 was launched. Here, we will discuss how Node.js and Express JS can be implemented and linked to Drupal CMS via a Restful API.

Drupal 8

So, before heading on with this blog; we think that you already are aware with:

  • Drupal
  • JavaScript
  • JSON

Node.js : It is a web server that can offer JavaScript for a client but it can also run JavaScript on the server itself. The JavaScript here performs the task of PHP. Node.js can be easily installed.

Express JS: Express JS Framework makes it easier to publish websites with Node.js. It provides routing and can be used with dynamic website applications as well as MVC based.

So, first let us understand how Drupal can be installed and configured:

  1. Installing and Configuring Drupal Core: Drupal 8 core contains Restful API that allows you to implement the GETs very quickly. Additional modules are to be written when we are dealing with Drupal 8 and then choose the minimal installation as we only need API as well as some additional modules.

    Installing and Configuring Drupal Core

    Once Drupal 8 is installed; one can first activate Drupal administrative theme in order to get a graphic backend.

    Now, the Toolbar module is to be installed for easier navigation via Drupal backend. The modules field is also needed in order to configure content type.

    And the module “Views UI” defines the restful Web Service.

  2. Unnecessary Blocks: A little clean up is to be performed here. Still, there are two unnecessary blocks at the top of the page: Tools & Administration. These blocks can be removed under admin structure block.
  3. Content type “Blog”: A content type blog must include these fields: Title, Body and Image.

    Define Drupal 8 content type as well as fields. For the blog, an Image field is needed as other required fields and data are already provided by Drupal core.

Configuring Drupal8 Web Service:

Here, the content type is defined and the required Web Service can be created. First create a new view ( Admin/ structure/views/add)

Now, export the “Rest” and make sure to check it. Then give it the name “Blogs JSON export” as well as the URL “blogsexportall”.

Configuring Drupal 8 Rest export View:

Under “Show” choose “Fields” instead of ‘Entity’. The fields required here will be:

  1. Title: Formatted “plain text” will be used with “link to content”.
  2. Authored on: The custom format YMD is to be used as it is the right format for which will be used in the front end.
  3. Blog Image: Here, large image will be added with the text on the top of the blog with Image Style “None” and “Link image to: nothing”.
  4. Authored on: This will be used for the date of the blog item with the custom format DYM.
  5. Body: It will be used for body text on the blog detail page with all default settings
  6. Authored by: This will be used for the name of blogger with all default settings.
  7. Author image: The author image is to be added at the bottom of the blog with all default settings.
  8. Author signature: The signature of the blogger is to be used with his her name at the bottom of the blog with all default settings.

Wind Up:

This is the minimal sort of Drupal installation done here along with its configuration so that it can have backend where content managers can manage blogs. It subsequently generates data in proper format.

For more such guidelines and updates about Drupal, stay tuned with Softqube Technologies, Drupal web Design India.

Hari Patel

Hari Patel

I am the Managing Director of Softqube Technologies Pvt. Ltd., a modern-day digital transformation, design and development service provider. We provide services to businesses of all verticals across the globe. I believe and live by a mission that I help more entrepreneurs to build, launch and grow profitable businesses.