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

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -