所以,我有两个文件,一个是server.js,另一个是db.js该db.js文件用猫鼬我的数据库交互,我用server.js调用函数从db.js
var mongoose = require('mongoose');
mongoose.connect('', { useNewUrlParser: true })
var Schema = mongoose.Schema;
module.exports = function () {
var db = mongoose.connection;
db.on('error', console.error.bind(console, 'connection error:'));
return db.once('open', function() {
console.log("Connected to DB")
var postschema = new Schema({
title: String,
intro: String,
body: String,
author: String,
timestamp: { type: Date, default: Date.now }
});
var post = mongoose.model('post', postschema);
return {
newPost(title, intro, body, author) {
var newpost = new …Run Code Online (Sandbox Code Playgroud) 有没有办法在 Windows 上使用 Node 获取进程运行了多长时间?我想搜索特定进程并获取其运行时间。