Closed MorganBergen closed 1 month ago
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
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 callrouter.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
andfamilyConditions