You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-12-25 00:40:59 +03:00
Have client.connect() return a Promise<RedisClient> (#2602)
* Connect returns the instance of the client * Added a test * No auto setup * Added a bit of docs * fix the return type, test, and the docs * fix return type * Update packages/client/lib/client/index.spec.ts Co-authored-by: Francisco Presencia <franciscop@users.noreply.github.com> --------- Co-authored-by: Leibale Eidelman <me@leibale.com>
This commit is contained in:
committed by
GitHub
parent
5a108265da
commit
fb255eb5d0
@@ -51,11 +51,9 @@ Looking for a high-level library to handle object mapping? See [redis-om-node](h
|
||||
```typescript
|
||||
import { createClient } from 'redis';
|
||||
|
||||
const client = createClient();
|
||||
|
||||
client.on('error', err => console.log('Redis Client Error', err));
|
||||
|
||||
await client.connect();
|
||||
const client = await createClient()
|
||||
.on('error', err => console.log('Redis Client Error', err))
|
||||
.connect();
|
||||
|
||||
await client.set('key', 'value');
|
||||
const value = await client.get('key');
|
||||
|
||||
Reference in New Issue
Block a user