COVID-19 UPDATES API is used to help customers obtain the status of COVID-19 casess. This application is used to view COVID-19 updates based on country through provience level. It also displays the total number of deaths, infected, recovered and number of active casess based on the refined search though selected country and provience.
- Open command prompt and navigate to the desired path.
- Clone the source code from the github repo and copy the path below and hit Enter git clone https://github.com/ravikoppula/COVID19-UpdatesWebAPI.Net6.git
- Open the folder path and find COVID19-UpdatesWebAPI.Net6.sln file. Also, double clicking on the file will open the solution in the visual studio 2022.
- Inside the COVID19-UpdatesWebAPI.Net6 Solution, launchSettings.json can be found under the properties folder which helps to set up the launch settings.
- Controllers can be found under the controller folder (which is used for request & user response)
- Interfaces folder contains all the interfaces which are implemented for the future.
- Services folder will store the logic and process HTTP response (User response).
- Under the Models folder - View model and Data folder are stored.
- View Models is used to bind the output parameter.
- Data Folder will be used to store the files (Ref: Git repo).
- View folder to design HTML pages to interact with the user.
- Appsettings.json is used for data connection or any security tokens in the future for Git Access.
- In Program.cs file contains all the dependency injection (DI) which is used in the project along with the routing path for project launch.
- Build the solution by hitting F6 button. Alternatively, build option can be chosen from the top menu from Visual studio.
- Run the solution by hiting F6 button. Consequently, hitting on Ctrl+shift+c keys will allow step 1 and step 2 to build and run the solution concurrently.
- Once the build and run is sucessful, solution will render the default setting page followed by the display of the dashboard (use GOOGLE CHROME for better optimization)
- API is tested from the frontend by entering the country,state and date inputs.
- Right click on the COVID19-UpdatesWebAPI.Net6.XUnitTest solution and set as a start up project
- Hit on Ctrl + R, A.
- In the test explorer you will find the test cases status.
https://localhost:7139/api/covid19updates/getcovid19updates
https://localhost:7139/api/covid19updates/getcovid19updates?country=Canada&state=&lastUpdatedDate=0001-01-01
Parameter | Type | Description |
---|---|---|
country |
string |
Optinal. country name to get to fetch |
state |
string |
Optinal. state name to get to fetch |
lastUpdatedDate |
datetime |
Optinal. datetime name to get to fetch |
Takes country, state and last updated date and return the covid updates.
Note: Country, state and Last updated date are optional fields.**
- Login to Postman Web. Please click the link below to open Postman Web. Alternatively, Postman can be downloaded directly on Windows. Post man web - https://interstellar-flare-1652.postman.co/
- For first-time users, please sign-in to record your activities under history session.
- Retain the solution in run mode to receive the API call.
https://localhost:7139/api/covid19updates/getcovi19dupdates?country=Brazil&state=Ceara
API Response:
[
{
"province\_State": "Ceara",
"country\_Region": "Brazil",
"confirmed": "336504",
"deaths": "10004",
"recovered": "269846",
"active": "56153",
"lastUpdatedDate": "2021-01-02T05:22:33"
},
{
"province\_State": "Ceara",
"country\_Region": "Brazil",
"confirmed": "336574",
"deaths": "10015",
"recovered": "270203",
"active": "56356",
"lastUpdatedDate": "2021-01-03T05:22:52"
}
]
API Request
https://localhost:7139/api/covid19updates/getcovi19dupdates?country=Brazil
API Response:
Resoinse JSON was not attached as the API response is lengthy.
https://localhost:7139/api/covid19updates/getcovi19dupdates?state=Ceara
API Response:
[
{
"province\_State": "Ceara",
"country\_Region": "Brazil",
"confirmed": "336504",
"deaths": "10004",
"recovered": "269846",
"active": "56153",
"lastUpdatedDate": "2021-01-02T05:22:33"
},
{
"province\_State": "Ceara",
"country\_Region": "Brazil",
"confirmed": "336574",
"deaths": "10015",
"recovered": "270203",
"active": "56356",
"lastUpdatedDate",
"2021-01-03T05:22:52"
}
]
API Request
https://localhost:7139/api/covid19updates/getcovi19dupdates?lastUpdatedDate=2021-01-02
Test 4: View data without any filter selection:
API Request
API Request: https://localhost:7139/api/covid19updates/getcovi19dupdates
To run tests, run the following commands
dotnet test
Run the tests using COVID19-UpdatesWebAPI.Net6.dll assembly:
dotnet test ~/COVID19-UpdatesWebAPI.Net6/COVID19-UpdatesWebAPI.Net6.XUnitTest/bin/debug/net6.0/COVID19-UpdatesWebAPI.Net6.dll
Self-contained deployment windows
dotnet publish -c Release -r <RID> --self-contained false
dotnet publish -c Release
( or ) Publish an app self-contained and ReadyToRun. A Windows 64-bit executable is created.
dotnet publish -c Release -r win-x64 -p:PublishReadyToRun=true
Publish an app self-contained and ReadyToRun. A macOS 64-bit executable is created.
dotnet publish -c Release -r osx-x64 -p:PublishReadyToRun=true
Client: Bootstrap, HTML, CSS, Jquery and AJax
.Net Version: NetCore 6.0.301
Solution pattern: Model View Controller (MVC)
Web Api C#.
Third Part Tools Swagger UI to test API methods.