Stock price tracker - code review

Stock price tracker - code review
0

#1

Hello,

I’m looking for a code review on stock price tracker project which you can find here:

GitHub: https://github.com/tanimmahmud/Information-Security-and-Quality-Assurance-Projects---Stock-Price-Checker

Live: https://opposite-sundial.glitch.me/

Thanks in advance :slight_smile: Really appreciate your help.

Tanim


#2

Is it possible to see price over time?


#3

I did not get your question …


#4

Give me clear example want to you want


#5

Exactly how do you track the price?

You can do it in Google quite easily


#6

I am using this third party api for stock price “https://api.iextrading.com/1.0/stock/"+stock+"/quote”;


#7

I just want someone to review my code !


#8

I am using this third party api for stock price “https://api.iextrading.com/1.0/stock/"+stock+"/quote”;


#9

I’m not sure what the challenge is asking for but what you have so far seems to be a basic API tester.
It does not have a user friendly interface or any graphs/charts showing history over time.
If you want your code reviewed it is combined with what seems to be free code camp boilerplate code so what do you want us to review? :face_with_raised_eyebrow:


#10

Thanks for your reply. Here is the challenge link https://learn.freecodecamp.org/information-security-and-quality-assurance/information-security-and-quality-assurance-projects/stock-price-checker. If you could review controller/stockHandler.js and routes/server.js pages than I will be grateful. Thanks


#11

As this is just testing an api, you can test if it works or not.
Your code looks fine to me. :slight_smile:


#12

I look on git and I found on forumsthat await and async is out of date use New Promise callback

second you have unnecesary code of likes without likes. it will be hard to maintain.
obj.likes = 1; with this you cannot have likes more than one.


#13

Thanks :slight_smile:


#14

Thanks :slight_smile: actually in the challenge it says you can not have likes more than one. 1 is the maximum value you can store.


#15

not have likes more than one per one IP.


#16

that was the requirement for this challenge .


#17

PER ONE IP, but summary there could be unlimited likes. plural likes.


#18

Oh… I interpreted it wrong !! Thanks for you clarification.


#19

You mix var and let in a lot of your code. I would go through and update to just using one. Most of your variables could be const though because they are not getting redefined.

I would clean up your routes file.
Expect from chai is being imported and I don’t see it being used.
I would instantiate StockHandler controller outside of your export function as well as move the findAndUpdate function out of it as well.
You use Array.isArray(stock) multiple times so I would just store that result in a variable.

I would give more descripted function/variable names. Some people (myself included) does not know what stockHandler.stockObj does and won’t want to go search your controller to find out.