diff --git a/README.md b/README.md index 974407fce4..ab949a199b 100644 --- a/README.md +++ b/README.md @@ -36,16 +36,14 @@ npm install redis ```typescript import { createClient } from 'redis'; -(async () => { - const client = createClient(); +const client = createClient(); - client.on('error', (err) => console.log('Redis Client Error', err)); +client.on('error', (err) => console.log('Redis Client Error', err)); - await client.connect(); +await client.connect(); - await client.set('key', 'value'); - const value = await client.get('key'); -})(); +await client.set('key', 'value'); +const value = await client.get('key'); ``` The above code connects to localhost on port 6379. To connect to a different host or port, use a connection string in the format `redis[s]://[[username][:password]@][host][:port][/db-number]`: