From the course: Databases for Node.js Developers

Unlock this course with a free trial

Join today to access over 25,600 courses taught by industry experts.

Basic Redis operations for shopping baskets, part 2

Basic Redis operations for shopping baskets, part 2 - Node.js Tutorial

From the course: Databases for Node.js Developers

Basic Redis operations for shopping baskets, part 2

- [Instructor] In our current implementations, users can add things to the basket, but this does not reflect in the UI anywhere. But actually we already have the infrastructure in place to show the basket count, but right now we are not populating this specific variable. When I look into my Visual Studio Code and I go into views and there into layout, and look for basket, you will see that we are looking for a variable called basketCount. And if it's there, we show even a link to the basket. So what we need to do now is we have to somewhere add functionality to populate this central basket in our application. And for that, we will now create our own basket plugin. So now after extending the plugins, now finally you can write your own one. And for that, in plugins, I create the new file and then call it basket.js. In there I will now import, and this is now Fastify-specific. So we need to input the plugin function from fastify-plugin, it's fp, and then we can start writing the plugin…

Contents