Polarcraft/webv2/server/index.ts

15 lines
321 B
TypeScript
Raw Normal View History

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