Skip to content

Commit

Permalink
fix(gen:endpoint): Fix JSCS stuff and use Express 4 syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
Awk34 committed Jun 22, 2015
1 parent 349b6d3 commit 1bcffd6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions endpoint/templates/name.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function responseWithResult(res, statusCode) {
statusCode = statusCode || 200;
return function(entity) {
if (entity) {
return res.json(statusCode, entity);
return res.status(statusCode).json(entity);
}
};
}
Expand Down Expand Up @@ -41,7 +41,7 @@ function removeEntity(res) {
if (entity) {
return entity.removeAsync()
.then(function() {
return res.send(204);
return res.status(204);
});
}
};
Expand All @@ -50,8 +50,8 @@ function removeEntity(res) {
// Get list of <%= name %>s
exports.index = function(req, res) {<% if (!filters.mongoose) { %>
res.json([]);<% } %><% if (filters.mongoose) { %>
<%= classedName %>.find(function (err, <%= name %>s) {
if(err) { return handleError(res, err); }
<%= classedName %>.find(function(err, <%= name %>s) {
if (err) { return handleError(res, err); }
return res.status(200).json(<%= name %>s);
});<% } %>
};<% if (filters.mongoose) { %>
Expand Down

0 comments on commit 1bcffd6

Please sign in to comment.