Bringing in the Book Bundle UI

Now that you have your Router implemented and protected by authentication checks, it’s time to tack on the UI components to make it work end to end. The code for this is quite similar to the UI code you developed in Chapter 8, ​Creating a Beautiful User Experience​. And remember that you can review the b4-final application in the downloads that accompany this book, which include all of the code as well.

Open your index.ts file for editing. You’ll need a couple of methods—the first of which is getBundles. Add this code toward the top of the file, right after fetchJSON:

​ ​const​ getBundles = ​async​ () => {
​  ​const​ bundles = ​await​ fetchJSON(​'/api/list-bundles' ...

Get Node.js 8 the Right Way now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.