Created a boilerplate project for client and server environments

This commit is contained in:
veyselboybay committed 2024-05-03 12:29:37 -04:00
1 parent c8f75d460a
commit 22f360b636
17 files changed
+1277

No files matched your search

+18
View File
@@ -0,0 +1,18 @@
const mongoose = require('mongoose')
const PORT = process.env.PORT || 5000
const connectDbAndRunServer = async(app) => {
await mongoose.connect(process.env.DB_CONNECTION_STRING).then(() => {
console.log("DB connected")
// run server
app.listen(PORT, () => {
console.log(`server started on port:${PORT}`)
})
}).catch((err) => {
console.log(err)
})
}
module.exports = { connectDbAndRunServer }