javascript - MongoError: failed to connect to server [localhost:27017] on first connect [MongoError: connect ECONNREFU SED 127.0.0.1:27017] -


my question mongo not connecting server? , why saying failed connect server [localhost:27017] on first connect [mongoerror: connect econnrefu sed 127.0.0.1:27017]

here code: var express = require("express"), app = express(), bodyparser = require("body-parser"), mongoose = require("mongoose");   mongoose.connect("mongodb://localhost/blogapp"); app.set("views engine", "ejs"); app.use(express.static("public")); app.use(bodyparser.urlencoded({extended: true}));  app.get('/', function (req, res) { res.send('hello world!') });  app.listen(3000, function () { console.log('example app listening on port 3000!') }); 

install mongodb on machine, (if you're on mac, run brew install mongodb), open new terminal, , run mongod, relaunch app


Comments

Popular posts from this blog

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -