这是我已经拥有的架构文件。
function handleFiles(files) {
for (var i = 0; i < files.length; i++) {
var file = files[i];
var imageType = /^image\//;
if (!imageType.test(file.type)) {
continue;
}
var img = document.createElement("img");
img.classList.add("obj");
img.file = file;
preview.appendChild(img); // Assuming that "preview" is the div output where the content will be displayed.
var reader = new FileReader();
reader.onload = (function(aImg) { return function(e) { aImg.src = e.target.result; }; })(img);
reader.readAsDataURL(file);
}
}
当我将bewlow两个文件添加到架构中的文件
时 // defining a mongoose schema
// including the module
var mongoose = require('mongoose');
// declare schema object.
var Schema = mongoose.Schema;
var blogSchema = new Schema({
title : {type:String,default:'',required:true },
subTitle : {type:String,default:''},
blogBody : {type:String,default:''},
tags : [],// name of tags in array
created : {type:Date},
lastModified : {type:Date},
authorInfo : {} // information of author in form of obje-ct
});
mongoose.model('Blog',blogSchema);
在app.js中保存文件并运行命令节点app.js之后 如下所示抛出错误,即使安装了所有软件包
,我也在运行此文件 userName : {type:String,default:''} ,
passWord : {type:String,default:''}
like
// defining a mongoose schema
// including the module
var mongoose = require('mongoose');
// declare schema object.
var Schema = mongoose.Schema;
var blogSchema = new Schema({
title : {type:String,default:'',required:true},
subTitle : {type:String,default:''},
blogBody : {type:String,default:''},
tags : [],// name of tags in array
created : {type:Date},
lastModified : {type:Date},
authorInfo : {} // information of author in form of obje-ct
userName : {type:String,default:''} ,----------------------------------here
passWord : {type:String,default:''} ----------------------------------here
});