Join egghead, unlock knowledge.

Want more egghead?

This lesson is for members. Join us? Get access to all 3,000+ tutorials + a community with expert developers around the world.

Unlock This Lesson
Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.


    Render Domino Data using Handlebars templates in Express

    Mark BartonMark Barton

    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.



    Become a Member to view code

    You must be a Member to view code

    Access all courses and lessons, track your progress, gain confidence and expertise.

    Become a Member
    and unlock code for this lesson




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

    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.

    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.

    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.

    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.

    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.

    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.

    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.