EJS is a simple templating language that lets you generate HTML markup with plain JavaScript.
Where is EJS used ? EJS is used in node.js when working with the Express framework as a templating engine to help render JavaScript code on the client-side.
Why EJS? EJS is mostly useful whenever you have to output HTML with a lot of JavaScript.And ,If you’re dealing with generating dynamic content or offering something that has to do with real-time updates then it can reduce the code-load a big time.
To install EJS with NPM: $ npm install ejs
Tages :
<% ‘Scriptlet’ tag, for control-flow, no output
<%_ ‘Whitespace Slurping’ Scriptlet tag, strips all whitespace before it
<%= Outputs the value into the template (HTML escaped)
<%- Outputs the unescaped value into the template
<%# Comment tag, no execution, no output
<%% Outputs a literal ‘<%’
%> Plain ending tag
-%> Trim-mode (‘newline slurp’) tag, trims following newline
_%> ‘Whitespace Slurping’ ending tag, removes all whitespace after it.
Using the Google Books API:
You can perform a volumes search by sending an HTTP GET request to the following URI:
https://www.googleapis.com/books/v1/volumes?q=search+terms
This request has a single required parameter:
q - Search for volumes that contain this text string. There are special keywords you can specify in the search terms to search in particular fields, such as:
intitle: Returns results where the text following this keyword is found in the title.
inauthor: Returns results where the text following this keyword is found in the author.
inpublisher: Returns results where the text following this keyword is found in the publisher.
subject: Returns results where the text following this keyword is listed in the category list of the volume.
isbn: Returns results where the text following this keyword is the ISBN number.
lccn: Returns results where the text following this keyword is the Library of Congress Control Number.
oclc: Returns results where the text following this keyword is the Online Computer Library Center number.
Request Note: Performing a search does not require authentication, so you do not have to provide the Authorization HTTP header with the GET request. However, if the call is made with authentication, each Volume will include user-specific information, such as purchased status.
Response:If the request succeeds, the server responds with a 200 OK HTTP status code and the volume results