<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[.NET CORE 3.1 Web API For Beginners Part 02 — Reviewing the project files.]]></title><description><![CDATA[<p dir="auto"><img src="/assets/uploads/files/1604148261695-logo.jpg" alt="logo.jpg" class=" img-responsive img-markdown" /><br />
</p><section class="align-center">image is taken from <a href="http://www.syncfusion.com" target="_blank" rel="noopener noreferrer nofollow ugc">www.syncfusion.com</a></section><p></p>
<p dir="auto">In the previous article, I explained the basics of .Net Core web API, How to create a project and run it using .Net CLI. You can read it <a href="https://lankadevelopers.com/topic/714/net-core-3-1-web-api-for-beginners-part-01" target="_blank" rel="noopener noreferrer nofollow ugc">here</a>.</p>
<p dir="auto">Today as I promised, we gonna take a look at the project files that we have given out of the box and what responsible for getting us the result we saw in the previous article.</p>
<p dir="auto"><strong>Program.cs</strong></p>
<p dir="auto"><img src="/assets/uploads/files/1604148342044-program-resized.png" alt="program.png" class=" img-responsive img-markdown" /></p>
<p dir="auto">“Program.cs” is the most important file. because it is the starting point of our application. It contains a method called Main. When we hit the “dotnet run” command in the CLI, it’s looking for the “Main ”method in the “Program.cs” class and executes it. In the “Main ”method, it’s calling another method called “CreateHostBuilder” which you can see below the Main method and this responsible for configuring the webserver which is “Kestral ” with some default configurations. The configurations are read from appSettings.json / appsettings.Development.json files and we also provide some additional configurations inside a class called “Startup”.</p>
<p dir="auto">“Kestral” is an open-source cross-platform web server for <a href="http://Asp.Net" target="_blank" rel="noopener noreferrer nofollow ugc">Asp.Net</a> Core.</p>
<p dir="auto"><strong>appSettings.json / appsettings.Development.json</strong></p>
<p dir="auto"><img src="/assets/uploads/files/1604148404359-appsettings-resized.png" alt="appSettings.png" class=" img-responsive img-markdown" /></p>
<p dir="auto">We can give our application some configurations inside the “ appsettings.json” file or we can use “ appsettings.Development.json” for development mode.</p>
<p dir="auto"><strong>Startup.cs</strong></p>
<p dir="auto"><img src="/assets/uploads/files/1604148437933-startup-resized.png" alt="Startup.png" class=" img-responsive img-markdown" /></p>
<p dir="auto">In the Startup class, we can see a constructer with configurations injected into that. So that we can read configurations we defined in appsettings.json.</p>
<p dir="auto">There are another two methods called “ConfigureServices ”and “Configure”.<br />
The “ConfigureServices ” method is our dependency injection container. We can create and add our own services to this. I’ll explain what is dependency injection and how to write our own services and add those into our application via dependency injection in another article.</p>
<p dir="auto">“Configure” is the place where we add middleware. I’ll also explain the use of middleware with another article.</p>
<p dir="auto"><strong>Controllers</strong></p>
<p dir="auto"><img src="/assets/uploads/files/1604148495172-controller-resized.png" alt="controller.png" class=" img-responsive img-markdown" /></p>
<p dir="auto">There is a file called “WeatherForecastController.cs” in the controllers' folder. It is the default controller that comes with the .Net Core web API. What controllers does is, When we start our application it’s going to map all of our endpoints in our controllers so that our API knows where to send the request to.</p>
<p dir="auto"><strong>launchsettings.json</strong></p>
<p dir="auto"><img src="/assets/uploads/files/1604148550492-launchsettings-resized.png" alt="launchsettings.png" class=" img-responsive img-markdown" /></p>
<p dir="auto">There is another JSON file called “launchsettings.json”. When we start the application it also takes a look inside this file for any options. We have our application URL, environment variables, etc.</p>
<p dir="auto">These are the main files you need to know. To understand these things I will guide you on how to create our own API endpoints and services in upcoming articles.</p>
<p dir="auto">find me on medium - <a href="https://dlbnprabath.medium.com/" target="_blank" rel="noopener noreferrer nofollow ugc">https://dlbnprabath.medium.com/</a></p>
]]></description><link>https://lankadevelopers.lk/topic/720/net-core-3-1-web-api-for-beginners-part-02-reviewing-the-project-files</link><generator>RSS for Node</generator><lastBuildDate>Sun, 16 Aug 2026 07:12:28 GMT</lastBuildDate><atom:link href="https://lankadevelopers.lk/topic/720.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 31 Oct 2020 12:53:43 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to .NET CORE 3.1 Web API For Beginners Part 02 — Reviewing the project files. on Mon, 02 Nov 2020 16:03:17 GMT]]></title><description><![CDATA[<p dir="auto">thanks bro</p>
]]></description><link>https://lankadevelopers.lk/post/4004</link><guid isPermaLink="true">https://lankadevelopers.lk/post/4004</guid><dc:creator><![CDATA[dev_lak]]></dc:creator><pubDate>Mon, 02 Nov 2020 16:03:17 GMT</pubDate></item><item><title><![CDATA[Reply to .NET CORE 3.1 Web API For Beginners Part 02 — Reviewing the project files. on Sun, 01 Nov 2020 13:31:34 GMT]]></title><description><![CDATA[<p dir="auto">Thanks bro</p>
]]></description><link>https://lankadevelopers.lk/post/3997</link><guid isPermaLink="true">https://lankadevelopers.lk/post/3997</guid><dc:creator><![CDATA[Nubelle]]></dc:creator><pubDate>Sun, 01 Nov 2020 13:31:34 GMT</pubDate></item><item><title><![CDATA[Reply to .NET CORE 3.1 Web API For Beginners Part 02 — Reviewing the project files. on Sun, 01 Nov 2020 04:54:40 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://lankadevelopers.lk/uid/27">@root</a> Thanks bro.</p>
]]></description><link>https://lankadevelopers.lk/post/3995</link><guid isPermaLink="true">https://lankadevelopers.lk/post/3995</guid><dc:creator><![CDATA[BuddhikaNelum]]></dc:creator><pubDate>Sun, 01 Nov 2020 04:54:40 GMT</pubDate></item><item><title><![CDATA[Reply to .NET CORE 3.1 Web API For Beginners Part 02 — Reviewing the project files. on Sun, 01 Nov 2020 00:32:21 GMT]]></title><description><![CDATA[<p dir="auto">Awesome bro, keep it up.</p>
]]></description><link>https://lankadevelopers.lk/post/3994</link><guid isPermaLink="true">https://lankadevelopers.lk/post/3994</guid><dc:creator><![CDATA[root]]></dc:creator><pubDate>Sun, 01 Nov 2020 00:32:21 GMT</pubDate></item></channel></rss>