This guide walks through first time for local development of this FHIR server. It includes setting up a native .NET environment via CLI and running the Microsoft SQL server through Docker.
-
Install .NET Core 6.0.100 by going to the .NET Core 6.0 download page, scrolling down to 6.0.0, and collapsing the dropdown to find 6.0.100 SDK. You can also find an alternative install on GitHub.
-
Install Docker Desktop to enable running containerized applications.
-
In a command line interface, download the MSSQL Docker image with the command:
docker pull mcr.microsoft.com/mssql/server:2022-latest
- Optional: increase Docker Desktop RAM to 4GB for smoother performance. 2GB minimum is required.
- Install .NET EF Core for managing database migrations and schema:
dotnet tool install --global dotnet-ef --version 7
-
Clone the Reference Server and make it the working directory.
-
Pick a secure random password, which the remainder of this guide will refer to as
yourStrong(!)Password. Never commit this password to GitHub. -
Open the file
messaging/appsettings.Development.jsonand modify theNVSSMessagingDatabasefield to use the PasswordyourStrong(!)Password. Never commit this password to GitHub. -
Launch MSSQL database server in the background via Docker:
docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=yourStrong(!)Password" -p 1433:1433 -d mcr.microsoft.com/mssql/server:2022-latest
- Optional: run
docker psto check working Docker services. - Note: On an Apple silicon Mac you may need to add
--platform=linux/amd64to the docker run command above. - Warning: Based on your shell special characters may need to be escaped or avoided.
- Load the database migrations:
dotnet ef --project messaging database update
- Note: To reset the database you can use
dotnet ef --project messaging database dropfollowed bydotnet ef --project messaging database update
- Run the server with the command below. It may ask you for a system password when generating a developer certificate.
dotnet run --project messaging
If it worked successfully you should see something like this:
Building...
[15:46:53 INF] Starting the NVSS FHIR API
[15:46:53 INF] Now listening on: https://localhost:5001
[15:46:53 INF] Now listening on: http://localhost:5000
[15:46:53 INF] Background job processing has started
[15:46:53 INF] Application started. Press Ctrl+C to shut down.
[15:46:53 INF] Hosting environment: Development
[15:46:53 INF] Content root path: /Users/nightingaleproject/nvss/Reference-NCHS-API/messaging
- If the system keeps prompting you for a password, you can have the system trust your new developer cert by running the command:
dotnet dev-certs https --trust
- To confirm the server is running properly, visit https://127.0.0.1:5001/swagger/v1/swagger.json, where you should get a JSON file and see
StatusCode: 200in the server logs. Authentication and authorization are disabled in development mode. You can view the REST API documentation on GitHub Pages or http://localhost:5001/swagger/index.html.
From messaging directory with MSSQL database already running, run:
dotnet test- Checkout our Testing Tools to quickly populate the FHIR API database with content suitable for exercising the software.
- Launch the Status UI to get a NVSS FHIR messages status dashboard.
- Use the Canary Testing Framework to generate sample FHIR messages.
- Try the Postman Collections provided, but disregard authentication and use
https://127.0.0.1:5001/as the base URL.