DEV Community

Cover image for Host and Use Redis for Free

Host and Use Redis for Free

Ramki Pitchala on April 21, 2021

This article was originally posted on Medium. If you prefer reading it from there, please do check it out. Introduction Although buildi...
Collapse
 
ceddy profile image
Ceddy Muhoza

Checkout Upstash too!

Collapse
 
ramko9999 profile image
Ramki Pitchala

Yeah it looks promising!

Collapse
 
aehelaly profile image
Ahmad Helaly

Thx a lot, Upstash is EXACTLY what I have been searching for :)

Collapse
 
amreshsinha profile image
Amresh Prasad Sinha • Edited

Is it now not working? I tried the exact same thing but it prints out nothing on the console.
Here's the code:

const redis = require("redis");
require("dotenv").config();

const client = redis.createClient({
  host: process.env.REDIS_URI,
  port: process.env.REDIS_PORT,
  password: process.env.REDIS_PASSWORD
});

client.on("connect", () => {
  console.log("Connected to our redis instance!");
  client.set("Greatest Basketball Player", "Lebron James");
});
Enter fullscreen mode Exit fullscreen mode

One more thing... This thing works fine in npm package redis@3.1.2 but not with latest 4.0.3 (as of now)

Any help will be appreciated.
Thanks!

Collapse
 
ramko9999 profile image
Ramki Pitchala

I see, so if I understand it correctly. There wasn't an error with redis@3.1.2 but it didn't print "Connected to our redis instance!" to the console. But with 4.0.3, it gave an error when compiling?

Collapse
 
zilti_500 profile image
Daniel Ziltener

It is like everyone magically forgot how to install software, and now it's "did you already use this cool cloud service that totally doesn't do exactly what you could achieve by zypper in redis?"

Collapse
 
ramko9999 profile image
Ramki Pitchala

I will look into zypper.

Collapse
 
yashspr profile image
Yashas Reddy

Thanks. This is helpful for windows users.

Collapse
 
codingjlu profile image
codingjlu

This (redis-windws) worked perfectly for me on Windows :)

Collapse
 
gealber profile image
Gealber Morales

Thanks for sharing this, it was pretty useful for me.

Collapse
 
gopeeey profile image
gopeeey

Thank you so much for this