-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add basic auth to FHIR server configuration (#287)
- Loading branch information
Showing
5 changed files
with
258 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { NextRequest, NextResponse } from "next/server"; | ||
import { testFhirServerConnection } from "../../query-service"; | ||
|
||
/** | ||
* Test FHIR connection | ||
* @param request - Incoming request | ||
* @returns Response with the result of the test | ||
*/ | ||
export async function POST(request: NextRequest) { | ||
try { | ||
const body = await request.json(); | ||
const { url, bearerToken } = body; | ||
|
||
if (!url) { | ||
return NextResponse.json( | ||
{ success: false, error: "URL is required" }, | ||
{ status: 400 }, | ||
); | ||
} | ||
|
||
const result = await testFhirServerConnection(url, bearerToken); | ||
return NextResponse.json(result); | ||
} catch (error) { | ||
console.error("Error testing FHIR connection:", error); | ||
return NextResponse.json( | ||
{ success: false, error: "Internal server error" }, | ||
{ status: 500 }, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.