Skip to content

Commit 29ee0b1

Browse files
author
Dan McGhan
committed
Changed Number to parseInt for primitive value
1 parent 3054a69 commit 29ee0b1

File tree

2 files changed

+2
-2
lines changed
  • javascript/rest-api
    • part-3-handling-get-requests/hr_app/controllers
    • part-4-handling-post-put-and-delete-requests/hr_app/controllers

2 files changed

+2
-2
lines changed

javascript/rest-api/part-3-handling-get-requests/hr_app/controllers/employees.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ async function get(req, res, next) {
44
try {
55
const context = {};
66

7-
context.id = Number(req.params.id);
7+
context.id = parseInt(req.params.id, 10);
88

99
const rows = await employees.find(context);
1010

javascript/rest-api/part-4-handling-post-put-and-delete-requests/hr_app/controllers/employees.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ async function get(req, res, next) {
44
try {
55
const context = {};
66

7-
context.id = Number(req.params.id);
7+
context.id = parseInt(req.params.id, 10);
88

99
const rows = await employees.find(context);
1010

0 commit comments

Comments
 (0)