我有以下代码:
var express = require('express');
var http = require('http');
var OrientDB = require('orientjs');
var util = require('util');
var httpApp = express();
http.createServer(httpApp).listen(8080, function() {
console.log("Server started on port 8080");
//conect to orientdb server
var server = OrientDB({
host: 'localhost',
port: 2480,
username: 'root',
password: '123456'
});
console.log('connected to orientdb.');
//list all databases
server.list()
.then(function(dbs) {
console.log('There are ' + dbs.length +' databases on the server.');
}).catch(function(e) {
console.error(e);
});
})
控制台结果是:
Server started on port 8080
connected to orientdb.
但是当我尝试显示数据库数量时没有任何反应。为什么then
或catch
不被执行?我应该配置一些东西吗?!?我想提一下,nodejs
服务器不会崩溃。