数据库插件

This commit is contained in:
robin
2022-05-31 08:34:53 +08:00
parent c764e7097d
commit 3494cecb9d
9 changed files with 171 additions and 9 deletions
+7
View File
@@ -0,0 +1,7 @@
module.exports = {
port: 6379, // Redis port
host: "192.168.1.26", // Redis host
// username: "", // needs Redis >= 6
password: "9715115286",
db: 0, // Defaults to 0
}
+14
View File
@@ -0,0 +1,14 @@
/**
* redis
*
* 参考文档:
* https://github.com/luin/ioredis
* https://luin.github.io/ioredis/classes/Redis.html
*/
const config = require("./config")
const Redis = require("ioredis");
module.exports = async (app) => {
const redis = new Redis(config);
app.redis = redis
}