I am trying to connect to a database that I have hosted at MLab. I am using the StrongLoop API. I've placed the config information for my hosted databases into my datasources.json and config.json files, but whenever I run the directory with npm start
, I get throw new Error ('double colon in host identifier';)
at api\node_modules\mongodb\lib\url_parser.js:45.
I have also made sure to install the loopback-connecter-mongodb npm package.
Here is a snippet of datasources.json (without the actual database details, of course):
{
"db": {
"name": "db",
"connector": "mongodb",
"host": "ds047355.mlab.com",
"database": "dbtest",
"username": "user",
"password": "fakepassword",
"port": 47355
}
}
Here is the config.json file:
{
"restApiRoot": "/api",
"host": "ds047355.mlab.com",
"port": 47355,
"remoting": {
"context": {
"enableHttpContext": false
},
"rest": {
"normalizeHttpPath": false,
"xml": false
},
"json": {
"strict": false,
"limit": "100kb"
},
"urlencoded": {
"extended": true,
"limit": "100kb"
},
"cors": false,
"errorHandler": {
"disableStackTrace": false
}
},
"legacyExplorer": false
}
Got any ideas?
config.json
as the data source ones, and this is not their place. the config should include the Host and Port of where you want loopback to run the node server, which locally could be0.0.0.0:3000
– Exuberate0.0.0.0
inconfig.json
and added the port as3000
, but I still get the same error... – Pompous:
or/
in your mongodb password – Menadione