Render Domino Data using Handlebars templates in Express

Mark Barton
InstructorMark Barton

Share this video with your friends

Send Tweet
Published 4 years ago
Updated 3 years ago

This lesson will demonstrate how to fetch Domino Data from a view which is then used within a handlebars template in the Express application before being rendered to the client.

Instructor: [00:00] We're going to render some HTML using Handlebars, and our Express app. We're going to feed into those Handlebars our Domino data.

[00:08] I've installed some packages Express [inaudible] Handlebars. I've configured my Express app to use the Handlebars as this engine. Within the [inaudible] thus far, we now going to add a new root, so let's call it a render data root.

[00:26] First thing we want to do is, configure our options for getting data in Domino. URL is going to use Domino data services to look at a view. We're going to be using the .get method. We're going to resolve the whole response in case there's any issues, and we're expecting JSON data. We'll make the request to Domino now, and then deal with the response.

[00:47] We should get back a array of records from the body. Then all we need to do is render out to our Handlebars which we're going to call demo, and pass it the data to be used within the Handlebars itself.

[01:03] Our Handlebars layout is a standard using the standard bootstrap style sheet. We're just using a container. We're going to be using cards with images on using the Domino data.

[01:14] In the Handlebars layout, we have the three braces which define where the actual template goes. If we look at that one, which is called demo.Handlebars, we're going to loop over the records, so no [inaudible] of Domino data and for each one, we will extract the image which is stored as a file, is also on the Domino data, and also the title or the name.

[01:37] Just note the Domino server itself is holding the images, so the URL needs to reference the Domino server and not the Node server. Within the notes application itself, I've changed the access control list to include anonymous with reader access, so they can read the data.

[01:52] Let's now see how that looks. I've started my server, entered my URL and the application renders the page correctly with data coming from Domino.