Skip to content

Commit

Permalink
Added support for redirects
Browse files Browse the repository at this point in the history
  • Loading branch information
Daryl Rowland committed Sep 7, 2016
1 parent f9c5ed4 commit 862314b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,10 @@ var handleMethod = function(methodDefinition, req, res) {
authUser: authUser
};

routeMap[path][method][req.method.toLowerCase()](req, checkedParams.parameters, environment, function(err, result) {
if (err) {
routeMap[path][method][req.method.toLowerCase()](req, checkedParams.parameters, environment, function(err, result, redirect) {
if (redirect) {
res.redirect(redirect);
} if (err) {
res.status(500).send(err);
return;
} else {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cheese-toastie",
"version": "0.1.2",
"version": "0.1.3",
"description": "NodeJS API Builder",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 862314b

Please sign in to comment.