nodejs

redis connect

펀치맨 2022. 6. 9. 11:43

redis 라이브러리 사용시 연결 하는법

https://www.npmjs.com/package/redis

 

redis

A modern, high performance Redis client. Latest version: 4.1.0, last published: a month ago. Start using redis in your project by running `npm i redis`. There are 8397 other projects in the npm registry using redis.

www.npmjs.com

 

해당 라이브러리 4 버전기준, username 이 default 일때 연결하는 법은 다음과 같다.

 

import { createClient } from 'redis';

const url = 'redis://:{PASSWORD}@{HOST}:{PORT}';
export const redisClient = createClient({ url });
반응형