node+vue实现用户注册和头像上传的实例代码(2)

// lib/mongo.js const moogoose=require('mongoose'); moogoose.connect('mongodb://localhost/myblog'); moogoose.Promise = global.Promise; const db=moogoose.connection; // exports.db=db; // db.once('open',function () { // // }); var userSchema=new moogoose.Schema({ username:{type:'string',unique:true}, password:{type:'string'}, sex:{type:'string'}, pintroduction:{type:'string'}, name:{type:'string'}, filePath:{type:'string'} }, {collection:'user'} ); var user=moogoose.model('user',userSchema); exports.create=function (useres) { new user(useres).save(function (err,data) { }) };

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wyjjgp.html