-
-
Save laser/b66f3099b61af49286d7 to your computer and use it in GitHub Desktop.
n
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
expressRouter.get("/api/ledgers/:id", function(req, res) { | |
UserService.getLedgerById(req.params.id, function(err, ledger) { | |
if (err) { | |
res.status(404).json({"message": "Not Found"}); | |
} | |
else { | |
res.status(200).json(ledger); | |
} | |
}); | |
}); | |
expressRouter.patch("/api/users/:id", function(req, res) { | |
UserService.getUserById(req.params.id, function(err, user) { | |
if (err) { | |
res.status(404).json({"message": "Not Found"}); | |
} | |
else { | |
UserService.updateUser(id, req.body, function(err, user) { | |
if (err) { | |
res.status(400).json({"message": "Invalid data provided"}); | |
} | |
else { | |
res.status(200).json(user); | |
} | |
}); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment