mirror of
https://github.com/FranP-code/spend-ia.git
synced 2025-10-13 00:14:09 +00:00
feat: mongoose integration
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import mongoose from 'mongoose';
|
||||
|
||||
export interface User {
|
||||
id: string;
|
||||
name: string;
|
||||
@@ -16,3 +18,14 @@ export const db = {
|
||||
findMany: async () => users,
|
||||
},
|
||||
};
|
||||
|
||||
export default async (): Promise<void> => {
|
||||
await mongoose
|
||||
.connect(process.env.MONGO_URI as string)
|
||||
.then(() => {
|
||||
console.log('Connected to MongoDB');
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error('Error connecting to MongoDB:', error);
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user