moved api from monorepo
This commit is contained in:
		
							
								
								
									
										18
									
								
								config/db.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								config/db.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,18 @@
 | 
			
		||||
import mongoose from 'mongoose'
 | 
			
		||||
const MONGO_URI =
 | 
			
		||||
  Bun.env.NODE_ENV === 'development'
 | 
			
		||||
    ? Bun.env.MONGO_DEV_URI
 | 
			
		||||
    : Bun.env.MONGO_URI
 | 
			
		||||
 | 
			
		||||
const connectDB = async () => {
 | 
			
		||||
  mongoose.set('strictQuery', true)
 | 
			
		||||
  const conn = await mongoose.connect(MONGO_URI)
 | 
			
		||||
 | 
			
		||||
  console.log(
 | 
			
		||||
    `MongoDB Connected to ${
 | 
			
		||||
      conn.connection.host
 | 
			
		||||
    } using ${conn.connection.name.toUpperCase()} database`.cyan.underline.bold
 | 
			
		||||
  )
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export default connectDB
 | 
			
		||||
		Reference in New Issue
	
	Block a user