From the course: Databases for Node.js Developers

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Use Node.js with Redis

Use Node.js with Redis

From the course: Databases for Node.js Developers

Start my 1-month free trial

Use Node.js with Redis

- [Tutor] We will now use our Maxcoin application again, and we will implement what we did before with MongoDB now with Redis. For that I open Maxcoin and here the main Main-js file, and please also make sure that you are in the Maxcoin directory on the terminal. Let me will first just copy this mongoBackend require and do some renaming, so I call it RedisBackend equals require, and I will require the RedisaBackend that exists all ready, and then I will rename this run function into runMongo, so that we can reuse it later again, but I will also add a new function, runRedis, and it will copy paste runMongo for that simply and rename it to runRedis. And of course, here we have to now make an instance of RedisBackend and call RedisBackend max. Now, we also of course, have to call runRedis instead of run, everything else can stay the same, right now runMongo is unused. Now I head over to services and to the RedisBackend, and…

Contents