mirror of
https://github.com/Litlyx/litlyx
synced 2025-12-10 07:48:37 +01:00
add dashboard
This commit is contained in:
22
dashboard/server/init.ts
Normal file
22
dashboard/server/init.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import mongoose from "mongoose";
|
||||
import { Redis } from "~/server/services/CacheService";
|
||||
const config = useRuntimeConfig();
|
||||
let connection: mongoose.Mongoose;
|
||||
|
||||
export default async () => {
|
||||
|
||||
console.log('[SERVER] Initializing');
|
||||
|
||||
if (!connection || connection.connection.readyState == mongoose.ConnectionStates.disconnected) {
|
||||
console.log('[DATABASE] Connecting');
|
||||
connection = await mongoose.connect(config.MONGO_CONNECTION_STRING);
|
||||
console.log('[DATABASE] Connected');
|
||||
}
|
||||
|
||||
console.log('[REDIS] Connecting');
|
||||
await Redis.init();
|
||||
console.log('[REDIS] Connected');
|
||||
|
||||
console.log('[SERVER] Completed');
|
||||
|
||||
};
|
||||
Reference in New Issue
Block a user