-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
jerichofs
committed
Jan 7, 2020
1 parent
b8e145b
commit c752144
Showing
3 changed files
with
33 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
let data = require("../data"); | ||
|
||
const getBalance = (req, res) => { | ||
return res.status(200).json({ | ||
balance: data.accountValue | ||
}); | ||
}; | ||
|
||
module.exports = { | ||
getBalance | ||
}; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
const express = require("express"); | ||
const balance = express.Router(); | ||
|
||
const { getBalance } = require("../controllers/balance"); | ||
|
||
// Fetch current account balance | ||
balance.get("/", getBalance); | ||
|
||
// handle 404 error | ||
balance.use((req, res) => { | ||
res.status(404).json({ | ||
status: 404, | ||
msg: "Not Found." | ||
}); | ||
}); | ||
|
||
module.exports = balance; |
This file contains 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