'use strict'

const db = require('APP/db')
const Face = db.model('face')


module.exports = require('express').Router()
  .get('/',
    (req, res, next) =>
      Face.findAll()
        .then(faces => res.json(faces))
        .catch(next))



  .get('/:id',
    (req, res, next) =>
      Face.findById(req.params.id)
      .then(face => res.json(face))
      .catch(next))

  .put('/:id',
    (req, res, next) =>
    Face.findById(req.params.id)
    .then(face =>
      face.update(
        {quantity: req.body.quantity}
        ) 
      )
    .then(updatedFace => res.json(updatedFace))
    .catch(next))

  .delete('/:id', 
    (req, res, next) =>
    Face.destroy({
      where: {
        id: req.params.id
      }
    })
    .then(() => res.sendStatus(200))
    .catch(next))



@@ -233,16 +233,142 @@
 next))%0A%0A
+  .post('/', %0A    (req, res, next) =%3E%0A    Face.create(req.body)%0A    .then(face =%3E res.status(201).json(use))%0A    .catch(next))
 %0A%0A  .get

add route to post new face