feat: mongoose integration

This commit is contained in:
2023-07-04 23:06:32 -03:00
parent da3e6cb101
commit 6971eeda3c
9 changed files with 62 additions and 7 deletions

View File

@@ -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);
});
};