Feature: Edit a project

As a vision user
I want to update a project
So that I can change the repositories I monitor

Let's add a test to our existing set of tests ./test/project.js for our Edit a project feature. This resource will PUT a project to route /project/:id, and return a 204 No Content status:

describe('when updating an existing resource /project/:id', function(){
  var project = {
    name: "new test name"
    , user: login.user  
    , token: login.token
    , repositories    : [ "12345", "9898" ]
  };

  it('should respond with 204', function(done){

    request(app)
    .put('/project/' + id)
    .send(project)
    .expect(204, done);
  });
});

Let's implement the Edit a project feature ./lib/project/index.js and add a put function. We attempt to retrieve a project by calling the ...

Get Advanced Express Web Application Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.