Skip to content
This repository was archived by the owner on Dec 27, 2022. It is now read-only.

Latest commit

 

History

History
76 lines (52 loc) · 1.36 KB

File metadata and controls

76 lines (52 loc) · 1.36 KB

API Frontend

It deals with frontend logic required for WebApi of .NET Project

Requirements

  1. VS Code

  2. .NET 6.0

Commits

  1. .NET MVC Template

    Created by using following command

dotnet new mvc 
  1. Code Clean

  2. CoinStat API

// CoinStat Controller
[HttpGet]
public async Task<IActionResult> CoinStat_All()
{
    var response = await httpClient.GetAsync(Configuration.GetValue<string>("coinstat"));
    var content = await response.Content.ReadAsStringAsync();

    var Api = new List<Api>();
    // if (response.Content.Headers.ContentType.MediaType == "application/json")
    // {
    Api = JsonConvert.DeserializeObject<List<Api>>(content);
    // }
    return View(Api);
}
  1. CoinLore API
// CoinLore Controller
[HttpGet]
public async Task<IActionResult> CoinLore_Individual()
{
    var response = await httpClient.GetAsync(Configuration.GetValue<string>("coinlore"));
    var content = await response.Content.ReadAsStringAsync();

    var Api = new List<Api>();
    // if (response.Content.Headers.ContentType.MediaType == "application/json")
    // {
    Api = JsonConvert.DeserializeObject<List<Api>>(content);
    // }
    return View(Api);
}
  1. Final Changes

Start

To Start enter following command in terminal

dotnet run

Visit the following link

localhost:4000/