17 lines
445 B
TypeScript
17 lines
445 B
TypeScript
import mongoose from 'mongoose'
|
|
|
|
import { mongoUrl } from './const'
|
|
|
|
mongoose.connect(mongoUrl).then(() => {
|
|
console.log('Подключение к MongoDB успешно')
|
|
}).catch((err) => {
|
|
console.log('Неудачная попытка подключения к MongoDB')
|
|
console.error(err)
|
|
})
|
|
|
|
export default mongoose
|
|
|
|
// Для совместимости с CommonJS
|
|
module.exports = mongoose
|
|
module.exports.default = mongoose
|