Здравствуйте,
Вроде бы, все делаю согласно инструкции :), но у меня выскакивает ошибка при запуске приложения на Node.js
Где я допустил ошибку?
Server.jsvar express = require('express');
var app = express();
var path = require('path');
var port = process.env.PORT;
var mongoose = require('mongoose');
var configDB = require('./server/config/database.js');
mongoose.connect(configDB.url);
app.set('view engine', 'ejs');
app.set('views', path.resolve(__dirname, 'client', 'views'));
app.use(express.static(path.resolve(__dirname,'client')));
app.get('/', function(req,res){
res.render('index.ejs');
});
app.listen(port, function(){
console.log('Server is running... PORT ' + port);
});
Database.jsmodule.exports = {
'url': 'mongodb://' + process.env.IP
}
Customer.jsvar mongoose = require('mongoose');
var Schema = mongoose.Schema;
var customerSchema = mongoose.Schema({
firstname: String,
lastname: String,
phone: String,
address: {
street: String,
city: String,
state: String,
zip: String
}
});
module.exports = mongoose.model('Customer',customerSchema);
Err/home/ubuntu/workspace/node_modules/mongoose/node_modules/mongodb/lib/server.js:228
process.nextTick(function() { throw err; })
^
Error: connect ECONNREFUSED
at errnoException (net.js:905:11)
at Object.afterConnect [as oncomplete] (net.js:896:19)
Заранее спасибо!