Init Commit

This commit is contained in:
2024-12-16 18:32:04 +03:30
parent c178e162ca
commit 28ab698dfc
15 changed files with 1148 additions and 1 deletions
+24
View File
@@ -0,0 +1,24 @@
const mongoose = require('mongoose')
const port = process.env.PORT || 3000
const env = process.env.NODE_ENV || 'development'
module.exports = (app) => {
let connectionString
if (env === 'development') {
connectionString = process.env.MONGODB_URL
} else if (env === 'test') {
connectionString = process.env.MONGODB_URL
} else if (env === 'production') {
connectionString = process.env.MONGODB_URL
}
mongoose
.connect(connectionString, {})
.then(function () {
console.log('MongoDB Database Connected')
app.listen(port, function () {
console.log('Server Started On Port ' + port)
})
})
.catch(function (err) {
console.log(err)
})
}