Skip to content

Instantly share code, notes, and snippets.

@kylemocode
Created March 11, 2020 09:24
Show Gist options
  • Save kylemocode/5459496df845a8e61bce035cbda8fbf2 to your computer and use it in GitHub Desktop.
Save kylemocode/5459496df845a8e61bce035cbda8fbf2 to your computer and use it in GitHub Desktop.
export default class RedisDatabase {
redis: any;
constructor() {
this.redis = require('redis');
}
connectDB() {
const client = this.redis.createClient({
host: '127.0.0.1',
port: 6379
});
client.on("error", (err: string) => {
console.log("Error " + err);
});
client.on("ready", (err: string) => {
console.log("DB Ready");
});
return client;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment