/** * This is entry file when system running. * You can change in /config file */ import { RedisClientType } from "@redis/client"; /** * This one shows how to make a redis connection through database tookit. */ /** * Function 'H' is a syntactic sugar to get util tools quickly. * It will find the tool library automatically in '/lib/helper' or '/app/lib/helper'. */ export = {}; declare const MainRedis:RedisClientType; //For typescript :( const DBManager = H('database'); //Get database manager tookit const redisOption:DBOption = DBManager.getOption('redis'); //Make default connect option for redis // redisOption.host = option.Redis.host; //You can edit the option // redisOption.port = option.Redis.port; DBManager.create('redis',redisOption,'MainRedis',async (err:Error,redisClient:RedisClientType)=>{ //Create a redis database connection & Set a global property named 'MainRedis' that you can use it everywhere,don't forget decalre. LOGGER.log('Test connect redis server'); //Global logger tookit,support [ log | info | debug | warn | error ] 5 levels const info = await MainRedis.info(); LOGGER.debug(info); });