Initial Commit
This commit is contained in:
23
Proxy Scripts/fhirPatientRead.js
Normal file
23
Proxy Scripts/fhirPatientRead.js
Normal file
@@ -0,0 +1,23 @@
|
||||
(async () => {
|
||||
try {
|
||||
const token = await fhirInterface().getToken();
|
||||
|
||||
let config = {
|
||||
method: "get",
|
||||
url: `${fhirSettings.base_url}/DSTU2/Patient/${fhirSettings.patient_id}`,
|
||||
headers: {
|
||||
Accept: "application/json",
|
||||
Authorization: `${token.token_type} ${token.access_token}`,
|
||||
},
|
||||
};
|
||||
|
||||
const result = await axios(config);
|
||||
res.json(result.data);
|
||||
} catch (err) {
|
||||
if (err.response) {
|
||||
res.status(err.response.status).json(err.response.data);
|
||||
} else {
|
||||
res.status(400).json(JSON.stringify(err));
|
||||
}
|
||||
}
|
||||
})();
|
||||
Reference in New Issue
Block a user