mirror of
https://github.com/Litlyx/litlyx
synced 2025-12-12 08:38:38 +01:00
new selfhosted version
This commit is contained in:
14
dashboard/server/plugins/database.ts
Normal file
14
dashboard/server/plugins/database.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import mongoose, { Types } from "mongoose";
|
||||
import { VisitModel } from "~/shared/schema/metrics/VisitSchema";
|
||||
import fs from 'fs';
|
||||
|
||||
const config = useRuntimeConfig();
|
||||
|
||||
export default defineNitroPlugin(async nitroApp => {
|
||||
try {
|
||||
await mongoose.connect(config.MONGO_CONNECTION_STRING);
|
||||
console.log('Database connected')
|
||||
} catch (ex) {
|
||||
console.error(ex);
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user