In Drupal “Services” module help to create services for us. We can also able to create our own services in our custom modules. This can be achieved implementing hook_services(), this hook help to define our service type and service functionality.
To check given path is Drupal system path or not by using below functions. It check all Drupal system and modules path. It accepts string of path is argument return TRUE if valid path else FALSE if non exist path. We can able to pass wild cards for dynamic paths. For example node/*, comment/*. This function will check these type of paths also.
NodeJS is server side program it can return HTML pages based on user requirements. We can able to load HTML files instead of rendering HTML contents. There is a function sendFile() it accepts file path as argument and returns rendering file.
In NodeJS we can able to access the POST method request data using the “body-parser” module. This module parse the request by encoding the URL by calling the function. This urlencoded function accepts JSON object as input.
The Below example Shows creating HTML form in NodeJS with POST method and GET methods to display input.
In NodeJS we try to access the request from unknown URL(for example localhost) it blocks our request and return CROS error on browser. This type of errors are normally arise from Chrome browsers. To resolve this blocking we need to inform our express app to allow headers with specified access methods. Normal allowing methods are “PUT, GET, POST, DELETE, OPTIONS”.
In HTML normal special characters are considered as entities. So normally these are encoded as string. Normally &, <, >, ‘ and “ are special symbols. In PHP we can able to encode special symbols into HTML entity vice versa able to decode HTML entities into special symbols.
In PHP normally we use logical operators for validating. The operators performs operation with values and return Boolean value as TRUE or FALSE. Normal logical operators are AND(&&) and OR(||). We can able to replace logical operators with logical strings.
In Drupal system defines some paths. For example “node/add/CONTENT-TYPE”. We can change system path in custom module. There is hook function “hook_menu_alter()”. This hook loads all menu items in our system. By changing the items path by our custom path so system work with new path. In this hook we can also unset system path by unsetting item path.