Skip to content

fix(endpoint:thing): use Express 4 syntax #1026

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 27, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions app/templates/server/api/thing/thing.controller(models).js
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,23 @@ var Thing = sqldb.Thing;<% } %>
function handleError(res, statusCode) {
statusCode = statusCode || 500;
return function(err) {
res.send(statusCode, err);
res.status(statusCode).send(err);
};
}

function responseWithResult(res, statusCode) {
statusCode = statusCode || 200;
return function(entity) {
if (entity) {
return res.json(statusCode, entity);
return res.status(statusCode).json(entity);
}
};
}

function handleEntityNotFound(res) {
return function(entity) {
if (!entity) {
res.send(404);
res.status(404).end();
return null;
}
return entity;
Expand All @@ -58,7 +58,7 @@ function removeEntity(res) {
<% if (filters.mongooseModels) { %>return entity.removeAsync()<% }
if (filters.sequelizeModels) { %>return entity.destroy()<% } %>
.then(function() {
return res.send(204);
return res.status(204).end();
});
}
};
Expand Down