🎨 database connection
This commit is contained in:
parent
dfbb7419ae
commit
12d7b19919
1 changed files with 7 additions and 5 deletions
|
@ -9,12 +9,14 @@ import { url } from "@config/database";
|
|||
|
||||
export default async () => {
|
||||
await mongoose.connect(url).then(async (connection) => {
|
||||
logger?.info(`Connected to database: ${connection.connection.name}`);
|
||||
logger.info(`Connected to database: ${connection.connection.name}`);
|
||||
});
|
||||
mongoose.connection.on("error", (error) => {
|
||||
logger?.error(error);
|
||||
|
||||
mongoose.connection.on("error", async (error) => {
|
||||
logger.error(error);
|
||||
});
|
||||
mongoose.connection.on("warn", (warning) => {
|
||||
logger?.warn(warning);
|
||||
|
||||
mongoose.connection.on("warn", async (warning) => {
|
||||
logger.warn(warning);
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue