首页 > 解决方案 > 如何使用 express 和 xapi 与 vtc-lrs 包连接 mongo db LearningLocker_v2

问题描述

我是 xapi 的新手,我不知道将 mongo db 与 express 和 vtc-lrs 包的使用集成。这里我使用以下链接作为参考npm 包链接

我的代码是:

var express = require('express');
var app = express();
var http = require('http');
const xapi = require('vtc-lrs');
var bodyParser = require('body-parser');
app.use(bodyParser.urlencoded({ extended: true }));

app.use("/xapi", new xapi());
let options = {
lrs: new xapi.LRS(),  
connectionString:"mongodb://remote_url:27017/LearningLocker_V2",
getUser:function(req, res) {
  res.send("Connected Succesfully!");
},
baseUrl: "http://localhost:3000/xapi"
};
app.use("/xapi", new xapi(options) );

当我运行这张脸时,出现以下错误截图

标签: node.jsmongodblearning-locker

解决方案


推荐阅读