MorganBergen / clarity

Advanced ML for Nutritional Analysis and Healthcare Management
1 stars 0 forks source link

32 refactor code base #33

Closed MorganBergen closed 1 month ago

MorganBergen commented 1 month ago

ApiTest.js may not be needed but if you want to test some internal calls to make external calls then that's the module to do it with, however it could be stored elsewhere instead of the components directory.

In general the

axios.get(http://localhost:5001/api/conditions?q=${familyConditionInput}); will call

router.get('/conditions', async (req, res) => { // code });

which calls the external api

axios.get(https://clinicaltables.nlm.nih.gov/api/conditions/v3/search?terms=${query}&maxList=10);

same for medications and familyConditions

MorganBergen commented 4 weeks ago

api overview

internal api system in the app focusing on the medications endpoint

clarity is bifurcated into two main systems the client side react app and the server side node.js app using express. the server handles api requests and the client make requests to these endpoints to fetch or send data.

server/routes/api.js

a endpoint is defined in the api.js module. the endpoint is defined with a method (get, post, etc) and a url path. the method and path are used to handle the request and response objects.

/medications can be called with a get request to fetch all medications.

server/app.js