These are chat archives for apr15/apr15chat

2nd
May 2015
tania
@tania531
May 02 2015 03:43
hey samer - Im a little stuck on the 'get one' - I'm working on that first - here is what I'm trying to do based on the examples you found
// GET ONE

server.route({
  method: 'GET',
  path: '/tasks/' + task._id,
  handler: function (request, reply) {
    var task = new Task();

    task.find({}, function(err, task) {
        if (!err) {
            reply(task);
        } else {
            reply(Boom.badImplementation(err)); // 500 error
        }
    });
  }
});
so the main error is that 'task' isn't defined - which it isn't yet in the =3rd line
sorry to be lame but I am not sure how to construct this
tania
@tania531
May 02 2015 03:52
I see that task id has to be in { } now for example
Chris Oyler
@IAmEddieDean
May 02 2015 04:12
path: '/dogs/{dogId}'
this is an example from our work today of what that looks like, though I’m sure you have that by now
Samer Buna
@samerbuna
May 02 2015 04:24
@tania531 you should be using findOne for this
tania
@tania531
May 02 2015 04:29
ok yes
Emile just helped me work through the approximately 10 wrong things in that snippet I sent you!
He also refused to just point it out - he made me get there haha!
thank you
now I'm working on delete!