15 lines
321 B
TypeScript
15 lines
321 B
TypeScript
import mongoose from 'mongoose'
|
|
|
|
export default async () => {
|
|
try {
|
|
await mongoose.connect(config.mongoUrl, {
|
|
authSource: 'admin',
|
|
user: config.mongoUser,
|
|
pass: config.mongoPass
|
|
})
|
|
console.log('DB connection established')
|
|
} catch (e) {
|
|
console.error('DB connection failed', e)
|
|
}
|
|
}
|