Previous words
This article will describe in detail a web-based MONGODB database management tool developed with Nodejs mongo-express
Installation
First, the global installation of the Mongo-express package
NPM install-g mongo-express
Next, use the following command to locate the Mongo-express installation directory
NPM list-g mongo-express
The output results under WIN10 are:
C:\Users\Administrator\AppData\Roaming\npm
Then go to the Node_modules/mongo-express directory under the directory, locate the Config.js file, copy the file, and name the Config.default.js file
In this way, the Config.default.js file is saved in the default configuration, while Config.js is custom configured
Configuration
Next, modify the configuration file Config.js
...if(Process.env.VCAP_SERVICES) {varDblabel ='mongodb-2.4'; varenv =Json.parse (Process.env.VCAP_SERVICES); if(Env[dblabel]) {MONGO= env[dblabel][0].credentials; }} Else{MONGO={db:'Blogs', Host:"118.1.1.1", Port:27017, SSL:false, Username:'Blogs', Password:'123456', URL:"Mongodb://118.1.1.1:27017/blogs", //setting the connection string would only give access to that database//To see more databases your need to set Mongodb.admin to TRUE or add databases to the Mongodb.auth listConnectionString:process.env.ME_CONFIG_MONGODB_SERVER?"': Process.env.ME_CONFIG_MONGODB_URL,};} ...
Start
Because Mongo-express is a global installation, you can use the mongo-express command to start an app in any directory
Mongo-express
After the input is complete, the console outputs the following information
Mongo Express Server listening at http://localhost:8081"admin:pass" is This in your config.js! Database connectedconnecting to blogs ... Database Blogs Connected
In the Address bar, enter localhost:8081, username: admin, Password: Pass verification to log in
Managing MongoDB databases with Mongo-express