Skip to content

Commit f86ed40

Browse files
julie-ngdarkgl0w
andauthored
Update README.md
Co-authored-by: darkgl0w <[email protected]>
1 parent eebeddb commit f86ed40

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,20 @@ Once you have registered your plugin, you can access the Redis client via `fasti
4646
The client is automatically closed when the fastify instance is closed.
4747

4848
```js
49+
'use strict'
50+
51+
const Fastify = require('fastify')
52+
const fastifyRedis = require('fastify-redis')
53+
54+
const fastify = Fastify({ logger: true })
55+
56+
fastify.register(fastifyRedis, {
57+
host: '127.0.0.1',
58+
password: 'your strong password here',
59+
port: 6379, // Redis port
60+
family: 4 // 4 (IPv4) or 6 (IPv6)
61+
})
62+
4963
fastify.get('/foo', (req, reply) => {
5064
const { redis } = fastify
5165
redis.get(req.query.key, (err, val) => {

0 commit comments

Comments
 (0)