I am trying to connect a MongoDB URI to the strapi backend. I am able to connect with the main URL but when I created a .env.development variable, I am not able to connect to the database.
{
"defaultConnection": "default",
"connections": {
"default": {
"connector": "mongoose",
"settings": {
"uri": "${process.env.DATABASE_URI || ''}"
},
"options": {
"ssl": true
}
}
}
}
Ok, new plan.
try that :
npm install --save dotenv
require('dotenv').config()
{
"defaultConnection": "default",
"connections": {
"default": {
"connector": "mongoose",
"settings": {
"uri": `${process.env.DATABASE_URI || ''}`
},
"options": {
"ssl": true
}
}
} }