{"size": 498, "ext": "js", "max_stars_repo_path": "rest-api-node-express/backend/Controllers/itemControllers.js", "max_stars_repo_name": "peninahnaserian/Secure-SPA--react-node-mongo", "max_stars_repo_stars_event_min_datetime": "2021-06-24T18:10:33.000Z", "max_stars_repo_stars_event_max_datetime": "2021-06-24T18:10:33.000Z", "max_issues_repo_path": "rest-api-node-express/backend/Controllers/itemControllers.js", "max_issues_repo_name": "peninahnaserian/Secure-SPA--react-node-mongo", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "rest-api-node-express/backend/Controllers/itemControllers.js", "max_forks_repo_name": "peninahnaserian/Secure-SPA--react-node-mongo", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 19.1538461538, "max_line_length": 44, "alphanum_fraction": 0.483935743}
const Item = require('../Models/itemModel');

const addItem = (req,res) => {
    let newItem = new Item(req.body);
    newItem.save((err,Item) => {
        if(err){
            res.send(err);
        }else {
            res.json(Item);
        }
    })
}

const getItems = (req,res) => {
    Item.find({},(err,Item)=> {
        if(err){
            res.send(err);
        }else {
            res.json(Item);
        }
    })
}

module.exports.addItem = addItem;
module.exports.getItems = getItems;
