From the course: Databases for Node.js Developers
Unlock the full course today
Join today to access over 22,500 courses taught by industry experts or purchase this course individually.
Add Redis to your project
From the course: Databases for Node.js Developers
Add Redis to your project
- [Instructor] In our shopping application, we are going to use redis to implement first sessions and then also the shopping basket. But before we can do all that, we have to first bring in redis and configure it. So for that, please make sure that you are in the shopper directory again. And here, I now run NPM install ioredis. And to set up redis and to establish the connection, we will again, use serverbinstartJS and there I will first, after mongoose add const redis=requireioredis. Next, I switch really quick into the config file, and here in indexJS, I will now add a new property, redis aftermongoDB, because we also want to configure redis. And in our case, we first just need the port, and the port is 7379. So that's the port of our docker container. And I also add one more property, that's client, and it should be null. And this will make sense to you really soon. First, I head back now to startJS, and in there, I…