{"size": 526, "ext": "js", "max_stars_repo_path": "routes/index.js", "max_stars_repo_name": "SeanRussell-GitHub/CMS-Style--blog-site", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "routes/index.js", "max_issues_repo_name": "SeanRussell-GitHub/CMS-Style--blog-site", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "routes/index.js", "max_forks_repo_name": "SeanRussell-GitHub/CMS-Style--blog-site", "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": 30.9411764706, "max_line_length": 112, "alphanum_fraction": 0.6273764259}
const express = require('express');
const User = require('../db/models/User');

const router = express.Router();

router.get('/', async (req, res) => {
    const allUsers = await User.findAll().catch(err => {res.status(500).json('error finding users :(')});
    res.status(200).json(allUsers);
  });
  
  router.post('/', async (req, res) => {
    const newUser = await User.create(req.body).catch(err => {res.status(500).json('error creating user :(')});;
    res.status(201).json(newUser);
  });


  module.exports = router;