text: var express = require('express');
  var User = require('../schemas/user');
  var router = express.Router();
  
  router.get('/', function (req, res, next) {
    User.find({})
      .then((users) => {
        res.json(users);
      })
      .catch((err) => {
        console.error(err);
        next(err);
      });
  });
  
  router.post('/', (req, res, next) => {
    const user = new User({
      name: req.body.name,
      age: req.body.age,
      married: req.body.married,
    });
  
    user.save()
      .then((result) => {
        console.log("저장 후 결과: ", result);
        res.status(201).json(result);
      }).catch((err) => {
        console.log(err);
        next(err);
      });
  });
  
  module.exports = router;
  