Skip to content

Commit

Permalink
Added optimised JSON finding mechanism
Browse files Browse the repository at this point in the history
  • Loading branch information
code-reaper08 committed Jun 29, 2021
1 parent f7475f8 commit 4e62151
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ app.get('/',(req,res) => {
app.get('/:name',(req,res) => {
try{
DATA.laureates.forEach(laureate => {
const nameof = laureate.firstname;
if (req.params.name == nameof) {
const fname = laureate.firstname;
const sname = laureate.surname;
const fullname = fname.concat(sname);
if (req.params.name == fullname) {
res.status(200).send(laureate)
console.log("Can do shit")
}
Expand Down

0 comments on commit 4e62151

Please sign in to comment.