node.js - 如何使用 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) );
当我运行这张脸时,出现以下错误截图
解决方案
推荐阅读
- java - 从 Java 代码中使用 Flyway 创建新模式
- javascript - 在 React 中逐个字母“打印”字符串
- ansible - 如何从 ansible-modules 生成文档
- nginx - 在 Nginx SSL 设置中包含来自 Letsencrypt 的中间证书
- python - 理解 numpy np.tensordot
- node.js - 运行 localhost 时无法获取 NodeJS 错误
- tkinter - Tkinter 列表框按值选择(不是索引)
- node.js - NodeJS TCP socket 经常监听 END 事件
- python - 使用 Python 从文本中提取 IBAN
- javascript - 隐藏/显示链接点击的 div 不适用于自定义 wordpress 模板文件