'use strict';
var
  express = require('express'),
  router = express.Router();

router.use(require('../middlewares/auth'));

// GET /users
router.get('/', function(req, res, next) {
  // res.json(["users"]);
  res.status(200).json(
    {
      "users":[
        {"id":1,"name":"owner1","image_url":null},
        {"id":2,"name":"owner2","image_url":null},
        {"id":3,"name":"owner3","image_url":null},
      ]
    });
  return next();
});

// GET /users/:id
router.get('/:id', function(req, res, next) {
  res.status(200).json(
    {
      id: req.params.id, name: "John Doe", "image_url":null
    });
  return next();
});


router.get('/:id/flowers', function(req, res, next) {
  res.status(200).json(
    {
      "flowers":[
        {"name": "flower1", "count": 3},
        {"name": "flower2", "count": 4},
        {"name": "flower3", "count": 5},
      ],
      "send": [
      {
        "send_id": 2,
        "sender": 
          {"id": 2, "name": "user2", "image_url": null},
          "flower_name": "flower2", 
          "message": "message2"
      },
      {
        "send_id": 3,
        "sender": 
          {"id": 3, "name": "user3", "image_url": null},
          "flower_name": "flower3", 
          "message": "message3"
      },
      {
        "send_id": 4,
        "sender": 
          {"id": 4, "name": "user4", "image_url": null},
          "flower_name": "flower4", 
          "message": "message4"
      }]
    });
  return next();
});

router.post('/:id/flowers', function(req, res, next) {
  res.status(201);
  return next();
});


module.exports = router;

@@ -70,16 +70,55 @@
 Router()
+,%0A  knex   = require('../helpers/knex')
 ;%0A%0Aroute
@@ -1555,39 +1555,566 @@
 %7B%0A  
-res.status(201);%0A  return next(
+knex('flowers').where('name', req.body.flower_name)%0A    .then(function(row)%7B%0A      if(!row%5B0%5D) %7B%0A        res.status(404).send(%7B%0A          %22message%22: %22Flower Not Found%22%0A        %7D);       %0A      %7D%0A      knex('user_flowers').insert(%7Bsender_user_id: req.body.sender_id, reciever_user_id: req.body.reciever_id, flower_id: row%5B0%5D.id, message: req.body.message%7D)%0A        .then(function(row) %7B%0A          return res.status(201).send(%7B%0A            %22id%22: row%0A          %7D);%0A        %7D).catch(function(err) %7B%0A          return res.status(400).send(%7Berr%7D);%0A        %7D);%0A    %7D
 );%0A%7D

Add db for post request /:id/flowers