MongoDB+nodejs查询并返回数据
const express = require('express');
const router = express.Router();
const Monk = require('monk');
const Db = new Monk('localhost:27017/dictionary');//连接mongoDb地址
//返回数据接口
router.get('/getData', async function(req, res) {
let data1 = await Db.get('data').find();
res.json({
code : 2000,
data : data1
})
});