{"size": 831, "ext": "js", "max_stars_repo_path": "routers/update.js", "max_stars_repo_name": "peterwangfeng/angular-nodejs", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "routers/update.js", "max_issues_repo_name": "peterwangfeng/angular-nodejs", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "routers/update.js", "max_forks_repo_name": "peterwangfeng/angular-nodejs", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 23.0833333333, "max_line_length": 62, "alphanum_fraction": 0.5222623345}
/**
 * Created by WangFeng on 2017/2/28.
 */
var exp = require('express');
var Member = require('./info');
var router = exp.Router();

router.get('/edit/:id', function (req, res) {
    var id = req.params.id;
    Member.findById(id).exec(function (err, data) {
        if (err) {
        } else {
            res.json(data);
        }
    })
});

router.post('/api/edit/:id', function (req, res) {
    var id = req.params.id;
    var data = req.body;
    console.log(id);
    console.log(data);
    Member.findByIdAndUpdate(id, req.body, function (err) {
        if (err) {

        } else {
            res.json({code:'success',msg:'修改成功'})
        }
    })
});
// Member.update({name:},{age:100,isMale:false},function(err){
    //     if(!err){
    //         console.log('修改数据成功')
    //     }
    // })
module.exports = router;