<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>API Best Practices - TheCodeBuzz</title>
	<atom:link href="https://thecodebuzz.com/category/api-best-practices/feed/" rel="self" type="application/rss+xml" />
	<link>https://thecodebuzz.com</link>
	<description>Best Practices for Software Development</description>
	<lastBuildDate>Sun, 10 Mar 2024 15:38:18 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://thecodebuzz.com/wp-content/uploads/2022/11/cropped-android-chrome-512x512-1-1-51x51.jpg</url>
	<title>API Best Practices - TheCodeBuzz</title>
	<link>https://thecodebuzz.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Resolved: Swagger Failed to load API definition. Fetch error</title>
		<link>https://thecodebuzz.com/resolved-failed-to-load-api-definition-undefined-swagger-v1-swagger-json/</link>
					<comments>https://thecodebuzz.com/resolved-failed-to-load-api-definition-undefined-swagger-v1-swagger-json/#comments</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Tue, 05 Sep 2023 02:54:00 +0000</pubDate>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[API Best Practices]]></category>
		<category><![CDATA[Failed to load API definition]]></category>
		<category><![CDATA[Failed to load API definition (undefined /swagger/v1/swagger.json)]]></category>
		<category><![CDATA[Failed to load API definition Failed to fetch]]></category>
		<category><![CDATA[Failed to load API definition internal server error /swagger/v1/swagger.json]]></category>
		<category><![CDATA[Failed to load API definition swagger IIS]]></category>
		<category><![CDATA[Failed to load API definition swagger ui spring boot]]></category>
		<category><![CDATA[fetch errorundefined /swagger/v1/swagger.json]]></category>
		<category><![CDATA[Swagger definition not found]]></category>
		<category><![CDATA[swagger error]]></category>
		<category><![CDATA[undefined /swagger/v1/swagger.json]]></category>
		<guid isPermaLink="false">https://thecodebuzz.com/?p=5023</guid>

					<description><![CDATA[<p>Resolved: Swagger Failed to load API definition. Fetch error Today in this article, we will see a few resolution steps for errors &#8220;Swagger Failed to load API definition. Fetch error&#8221; Issue Description Swagger Open API documentation gives the below error in .NET API etc. &#8220;Failed to load API definition. Fetch error undefined /swagger/v1/swagger.json&#8221; It is [&#8230;]</p>
<p>The post <a href="https://thecodebuzz.com/resolved-failed-to-load-api-definition-undefined-swagger-v1-swagger-json/">Resolved: Swagger Failed to load API definition. Fetch error</a> first appeared on <a href="https://thecodebuzz.com">TheCodeBuzz</a>.</p>]]></description>
										<content:encoded><![CDATA[<h1 class="wp-block-heading">Resolved: Swagger Failed to load API definition. Fetch error</h1>



<figure class="wp-block-image"><a href="https://www.thecodebuzz.com/resolved-failed-to-load-api-definition-undefined-swagger-v1-swagger-json/" target="_blank" rel="noreferrer noopener"><img decoding="async" src="https://i1.wp.com/thecodebuzz.com/wp-content/uploads/2019/08/Failed-to-load-API-definition-Fetch-errorundefined-swagger-v1-swagger-1.jpg?fit=785%2C269&amp;ssl=1" alt="Failed to load API definition." class="wp-image-5050"/></a></figure>



<p></p>



<p>Today in this article, we will see a few resolution steps for errors &#8220;Swagger Failed to load API definition. Fetch error&#8221;</p>



<p></p>



<h2 class="wp-block-heading" id="aioseo-issue-description"><strong>Issue Description</strong></h2>



<p></p>



<p>Swagger Open API documentation gives the below error in .NET API  etc.</p>



<p></p>



<p class="has-vivid-red-color has-text-color has-medium-font-size">&#8220;Failed to load API definition. Fetch error undefined /swagger/v1/swagger.json&#8221;</p>



<p></p>



<p></p>



<p>It is observed that Swagger API documentation/description when it runs in publish mode i.e. hosted on IIS or Cloud Server or other servers produces the error like &#8220;<em><strong>Failed to load API definition&#8221; with undefined/swagger/v1/swagger.json error</strong></em>. </p>



<p></p>



<p></p>



<h2 class="wp-block-heading" id="aioseo-resolution">Resolution &#8211; Failed To Load API Definition</h2>



<p></p>



<p>Before applying this fix, I would recommend you validate the swagger implementation with the below article,</p>



<p></p>



<ul class="wp-block-list">
<li><em><a href="https://www.thecodebuzz.com/swagger-api-documentation-in-net-core-3-0/" target="_blank" rel="noreferrer noopener" title="Add Swagger API Documentation in ASP.NET Core 3.1">ASP.NET Core 3.1 or 6.0 &#8211; Add Swagger OpenAPI V3.0 specification documentation</a></em></li>
</ul>



<p></p>



<p><em>Please make sure you verify the below points</em> or <em>steps</em>,</p>



<p></p>



<div class="wp-block-aioseo-table-of-contents"><ul><li><a href="#aioseo-resolution-1">Resolution 1- Resolving Conflicting actions</a></li><li><a href="#aioseo-resolution-3">Resolution 2 &#8211; Missing HTTP Attributes</a></li><li><a href="#aioseo-resolution-5">Resolution 3- CORS or CSP issues</a></li><li><a href="#aioseo-resolution-1">Resolution 4 &#8211; Title and Version in Swagger</a></li><li><a href="#aioseo-resolution-6">Resolution 5 &#8211; Use the correct Swagger configuration</a></li><li><a href="#aioseo-resolution-6-other-issues">Resolution 6  &#8211;  Other Issues?</a></li></ul></div>



<p></p>



<p>The above steps might resolve your issue in any order depending on the type of issue you facing.</p>



<p></p>



<h2 class="wp-block-heading" id="aioseo-resolution-1">Resolution 1- Resolving Conflicting actions </h2>



<p></p>



<p>Please make sure the API doesn&#8217;t contain any<strong><em> conflicting action</em></strong>.  This is the most common cause of this issue.</p>



<p></p>



<p><a href="https://github.com/RicoSuter/NSwag/blob/master/src/NSwag.Generation.WebApi.Tests/App_Start/SwaggerConfig.cs" target="_blank" rel="noopener" title="">Conflicting action </a>could be using the same routes or the same HTTP verb abbreviations for GET, POST routes, etc. </p>



<p></p>



<p>To be on the safer side, you can very much use the below flag to control that behavior,</p>



<p></p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: csharp; title: ; notranslate">


c.ResolveConflictingActions(x =&gt; x.First());



</pre></div>


<p></p>



<h2 class="wp-block-heading" id="aioseo-resolution-3">Resolution 2 &#8211; Missing HTTP Attributes </h2>



<p></p>



<p>Please make sure all controller methods are attributed with proper <strong>HTTP </strong>attributes Example- [<strong>HttpGET] or [HttpPost] </strong>etc. </p>



<p></p>



<p>Any missing attribute accidentally on any such public method could cause the error.</p>



<p></p>



<p>If the issue persists then please apply the below<em> Resolution &#8211; 5 </em>to resolve the issue.</p>



<p></p>



<p></p>



<h2 class="wp-block-heading" id="aioseo-resolution-5">Resolution 3- CORS or CSP issues</h2>



<p></p>



<p></p>



<p>Please check if the hosting server allows CORS request processing. </p>



<p></p>



<p>Also, it is important swaggers UI-related resources like CSS or stylesheets are accessible from your server. </p>



<p></p>



<p>Swagger accessing resources from external sites may be not accessible due to <a href="https://www.thecodebuzz.com/content-security-policy-csp-swagger-ui-openapi/" target="_blank" rel="noopener" title="Content Security Policy for Swagger UI(OpenAPI)">CSP </a>issues as explained in <a href="https://www.thecodebuzz.com/content-security-policy-csp-swagger-ui-openapi/" target="_blank" rel="noopener" title="Content Security Policy for Swagger UI(OpenAPI)">this </a>article.</p>



<p></p>



<p>This is a common issue on a cloud server where you may need to whitelist a few domains.</p>



<p></p>



<h2 class="wp-block-heading" id="aioseo-resolution-1">Resolution 4 &#8211; Title and Version in Swagger</h2>



<p></p>



<p>Swagger Document is defined with proper <strong><em>Title </em></strong>and <em><strong>Version </strong></em>details, as both are <em><strong>required</strong></em> parameters.</p>



<p></p>



<p></p>



<h2 class="wp-block-heading" id="aioseo-resolution-6">Resolution 5 &#8211; Use the correct Swagger configuration</h2>



<p></p>



<p>Please, note that Swagger <strong>JSON </strong>will be exposed at the following route as per default behavior.</p>



<p></p>



<p>If you are using a custom route or prefix, then the route <strong>MUST </strong>include the {<strong>documentName</strong>} parameter.</p>



<p></p>



<p>To fix the issue, please update the UseSwagger() as below,</p>



<p></p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: csharp; title: ; notranslate">


app.UseSwagger(c =&gt;
{  c.RouteTemplate = &quot;&lt;custom-name&gt;/swagger/{documentName}/swagger.json&quot;;   }
);




</pre></div>


<p></p>



<p><strong>Example</strong>,</p>



<p></p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: csharp; title: ; notranslate">
 


c.RouteTemplate = &quot;MyTestService/swagger/{documentName}/swagger.json&quot;;  



</pre></div>


<p></p>



<p></p>



<p></p>



<p>The above changes also need to be reflected in SwaggerUI middleware. </p>



<p></p>



<p>Please update the <em><strong>UseSwaggerUI </strong></em>method will be as follows,</p>



<p></p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: csharp; title: ; notranslate">
app.UseSwaggerUI(c =&gt;
             {
                 c.SwaggerEndpoint(&quot;/&lt;custom-name&gt;/swagger/v1/swagger.json&quot;, &quot;TestService&quot;);
             });
</pre></div>


<p>Example:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: csharp; title: ; notranslate">
 app.UseSwaggerUI(c =&gt;
             {
          c.SwaggerEndpoint(&quot;/MyTestService/swagger/v1/swagger.json&quot;, &quot;TestService&quot;);
             }); 
</pre></div>


<p></p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>Please note that in Swaggerendpoint() method &#8216;documentName&#8217; value is cases sensitive.</p>



<p></p>



<p>In fact<strong><em>, documentName is case sensitive anywhere else if referenced</em></strong>.</p>



<p></p>



<p>This documentName is generally a Group Name associated with API version</p>
</blockquote>



<p></p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p><strong>Example</strong>: It won&#8217;t work for <strong><em>V1</em></strong> but works for v1.</p>
</blockquote>



<p></p>



<p>If using RoutePrefix in API then it can be defined as below,</p>



<p></p>



<p>Example only if using RoutePrefix, </p>



<p></p>



<pre class="wp-block-preformatted"><strong>c.RoutePrefix= "MyTestService/swagger"</strong></pre>



<p></p>



<p>Here <em><strong>MyTestService </strong></em>is my service name.</p>



<p></p>



<p>Please see below the complete implementation,</p>



<p></p>



<figure class="wp-block-image"><img fetchpriority="high" decoding="async" width="1316" height="924" src="https://i0.wp.com/thecodebuzz.com/wp-content/uploads/2019/09/Failed-to-load-API-definition.-Fetch-error-undefined-swagger-v1-swagger-json.jpg?fit=785%2C551&amp;ssl=1" alt="Failed to load API definition. with undefined/swagger/v1/swagger.json error. " class="wp-image-5646" srcset="https://thecodebuzz.com/wp-content/uploads/2019/09/Failed-to-load-API-definition.-Fetch-error-undefined-swagger-v1-swagger-json.jpg 1316w, https://thecodebuzz.com/wp-content/uploads/2019/09/Failed-to-load-API-definition.-Fetch-error-undefined-swagger-v1-swagger-json-300x211.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2019/09/Failed-to-load-API-definition.-Fetch-error-undefined-swagger-v1-swagger-json-1024x719.jpg 1024w, https://thecodebuzz.com/wp-content/uploads/2019/09/Failed-to-load-API-definition.-Fetch-error-undefined-swagger-v1-swagger-json-768x539.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2019/09/Failed-to-load-API-definition.-Fetch-error-undefined-swagger-v1-swagger-json-741x520.jpg 741w" sizes="(max-width: 1316px) 100vw, 1316px" /></figure>



<p></p>



<p> </p>



<p>Finally, Swagger runs successfully locally and in any hosting environment like <strong><em>IIS or Azure Cloud, </em></strong>etc.</p>



<p></p>



<p></p>



<p></p>



<figure class="wp-block-image"><img decoding="async" width="1313" height="924" src="https://i1.wp.com/thecodebuzz.com/wp-content/uploads/2019/08/Resolved-Failed-to-load-API-definition-Fetch-errorundefined-swagger-v1-swagger.jpg?fit=785%2C553&amp;ssl=1" alt="Failed to load API definition. Fetch error undefined /swagger/v1/swagger.json" class="wp-image-5051" srcset="https://thecodebuzz.com/wp-content/uploads/2019/08/Resolved-Failed-to-load-API-definition-Fetch-errorundefined-swagger-v1-swagger.jpg 1313w, https://thecodebuzz.com/wp-content/uploads/2019/08/Resolved-Failed-to-load-API-definition-Fetch-errorundefined-swagger-v1-swagger-300x211.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2019/08/Resolved-Failed-to-load-API-definition-Fetch-errorundefined-swagger-v1-swagger-1024x721.jpg 1024w, https://thecodebuzz.com/wp-content/uploads/2019/08/Resolved-Failed-to-load-API-definition-Fetch-errorundefined-swagger-v1-swagger-768x540.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2019/08/Resolved-Failed-to-load-API-definition-Fetch-errorundefined-swagger-v1-swagger-739x520.jpg 739w" sizes="(max-width: 1313px) 100vw, 1313px" /></figure>



<p></p>



<h2 class="wp-block-heading" id="aioseo-resolution-6-other-issues">Resolution 6  &#8211;  Other Issues?</h2>



<p></p>



<p>For any other issues, please use your browser debug tools to verify for specific errors.</p>



<p></p>



<p>For <strong>example </strong>&#8211; Google Chrome<strong> Dev tools</strong> ( <strong>F12</strong>), or Edge <strong>Developer tool</strong>s to verify the exact error causing the issue.  </p>



<p></p>



<p>Please verify the <strong><em>Console</em></strong> -&gt; <em><strong>Network </strong></em>tab to validate the exact error.</p>



<p></p>



<p></p>



<p></p>



<p><strong>Other References:</strong></p>



<p></p>



<p>Add swagger to ASP.NET Core API in simple 2-3 steps,</p>



<p></p>



<ul class="wp-block-list">
<li><a href="https://www.thecodebuzz.com/swagger-api-documentation-in-net-core-3-0/" target="_blank" rel="noreferrer noopener">Swagger API Documentation in .NET Core 6 or 3.1</a></li>
</ul>



<p></p>



<ul class="wp-block-list">
<li><a href="https://www.thecodebuzz.com/add-swagger-openapi-api-versioning-net-guidelines/" target="_blank" rel="noopener" title="Add OpenAPI Swagger API Versioning – Guidelines">API versioning support for Swagger/OpenAPI</a></li>
</ul>



<p></p>



<p>Did I miss anything else in these resolution steps? </p>



<p>Did the above steps resolve your issue? Please sound off your comments below!</p>



<p>Happy Coding !!</p>



<p></p>



<hr>



<p class=""></p>



<p class="has-background" style="background-color:#b6d9ac;font-size:18px"><br>Please <strong><em>bookmark </em></strong>this page and <em><strong>share </strong></em>it with your friends.                                                    Please <a href="https://www.thecodebuzz.com/subscription/" target="_blank" rel="noreferrer noopener"><em><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-luminous-vivid-orange-color"><strong>Subscribe</strong> </mark></em></a>to the blog to receive notifications on freshly published (2025) best practices and guidelines for software design and development.</p>




<br>



<hr>



<p class=""></p><p>The post <a href="https://thecodebuzz.com/resolved-failed-to-load-api-definition-undefined-swagger-v1-swagger-json/">Resolved: Swagger Failed to load API definition. Fetch error</a> first appeared on <a href="https://thecodebuzz.com">TheCodeBuzz</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://thecodebuzz.com/resolved-failed-to-load-api-definition-undefined-swagger-v1-swagger-json/feed/</wfw:commentRss>
			<slash:comments>31</slash:comments>
		
		
			</item>
		<item>
		<title>SeriLog Logging in ASP.NET Core with examples</title>
		<link>https://thecodebuzz.com/file-logging-in-net-core-2-2-and-net-core-3-0/</link>
					<comments>https://thecodebuzz.com/file-logging-in-net-core-2-2-and-net-core-3-0/#comments</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Tue, 29 Aug 2023 04:10:00 +0000</pubDate>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[API Best Practices]]></category>
		<category><![CDATA[.net 6 serilog logging]]></category>
		<category><![CDATA[.net core serilog logging]]></category>
		<category><![CDATA[.net core6 serilog logging]]></category>
		<category><![CDATA[configure serilog asp.net core]]></category>
		<category><![CDATA[custom file path serilog]]></category>
		<category><![CDATA[file logging asp]]></category>
		<category><![CDATA[file logging asp.net]]></category>
		<category><![CDATA[file logging asp.net 6]]></category>
		<category><![CDATA[file logging asp.net core 6]]></category>
		<category><![CDATA[file logging net 6]]></category>
		<category><![CDATA[file logging net core]]></category>
		<category><![CDATA[file logging net core6]]></category>
		<category><![CDATA[log file using serilog]]></category>
		<category><![CDATA[log to file net core]]></category>
		<category><![CDATA[log to file net core 6]]></category>
		<category><![CDATA[log to file net core6]]></category>
		<category><![CDATA[log to file using serilog]]></category>
		<category><![CDATA[Loglevel serilog]]></category>
		<category><![CDATA[net core 6]]></category>
		<category><![CDATA[Rolling File logging in .NET Core]]></category>
		<category><![CDATA[Rolling File logging in .NET Core 6]]></category>
		<category><![CDATA[rolling file logging serilog]]></category>
		<category><![CDATA[serilog file logging asp.net core]]></category>
		<category><![CDATA[serilog file logging asp.net core 6]]></category>
		<category><![CDATA[serilog log .net core 6]]></category>
		<category><![CDATA[set up serilog asp.net core]]></category>
		<category><![CDATA[setup serilog.config asp.net core]]></category>
		<category><![CDATA[useserilog in asp.net core]]></category>
		<guid isPermaLink="false">https://thecodebuzz.com/?p=3540</guid>

					<description><![CDATA[<p>File/Rolling File Logging in ASP.NET Core using SeriLog Today in this article, we will see how to do file/rolling file logging using Serilog in ASP.NET Core API application. We shall be leveraging the DI( Dependency Injection) framework to inject the Serilog logger object into the API pipeline. Today in this article, we will cover below [&#8230;]</p>
<p>The post <a href="https://thecodebuzz.com/file-logging-in-net-core-2-2-and-net-core-3-0/">SeriLog Logging in ASP.NET Core with examples</a> first appeared on <a href="https://thecodebuzz.com">TheCodeBuzz</a>.</p>]]></description>
										<content:encoded><![CDATA[<h1 class="wp-block-heading"><strong>File/Rolling File Logging in ASP.NET Core using SeriLog</strong></h1>



<figure class="wp-block-image"><a href="https://www.thecodebuzz.com/file-rolling-file-logging-net-core-console-application/"><img decoding="async" width="1948" height="924" src="https://i1.wp.com/thecodebuzz.com/wp-content/uploads/2019/05/image-54.png?fit=785%2C373&amp;ssl=1" alt="SerilLog " class="wp-image-3559" srcset="https://thecodebuzz.com/wp-content/uploads/2019/05/image-54.png 1948w, https://thecodebuzz.com/wp-content/uploads/2019/05/image-54-300x142.png 300w, https://thecodebuzz.com/wp-content/uploads/2019/05/image-54-1024x486.png 1024w, https://thecodebuzz.com/wp-content/uploads/2019/05/image-54-768x364.png 768w, https://thecodebuzz.com/wp-content/uploads/2019/05/image-54-1536x729.png 1536w, https://thecodebuzz.com/wp-content/uploads/2019/05/image-54-785x372.png 785w" sizes="(max-width: 1948px) 100vw, 1948px" /></a></figure>



<p>Today in this article, we will see how to do file/rolling file logging using <strong>Serilog </strong>in<strong> ASP.NET Core API</strong> application.</p>



<p></p>



<p>We shall be leveraging the <strong>DI</strong>( Dependency Injection) framework to inject the Serilog logger object into the API pipeline.</p>



<p></p>



<p>Today in this article, we will cover below aspects,</p>



<p></p>



<div class="wp-block-aioseo-table-of-contents"><ul><li><a href="#aioseo-getting-started">Getting started</a><ul><li><a href="#aioseo-create-an-asp-net-core-api-using-net-core-3-1-or-net-5">Create an ASP.NET Core API using .NET Core 3.1 or .NET 6</a></li><li><a href="#aioseo-update-main-method">Update Main() method</a></li></ul></li><li><a href="#aioseo-main-method-in-asp-net-core-3-1-and-above-framework">The main method in ASP.NET Core 3.1 and the above framework</a></li><li><a href="#aioseo-basic-file-logging">Basic File Logging</a><ul><li><a href="#aioseo-update-host-builder-asp-net-core-api-pipeline">Update Host Builder ASP.NET Core API Pipeline</a></li></ul></li><li><a href="#aioseo-summary">Summary</a></li></ul></div>



<p></p>



<p>Logging in<strong> </strong>.NET 3.1 onwards framework is simplified further.</p>



<p></p>



<p> In the last article, we saw how to <a href="https://www.thecodebuzz.com/logging-in-net-core-2/" target="_blank" rel="noreferrer noopener">Enable Logging in ASP.NET Core using Built-in Providers</a>. </p>



<p></p>



<p>We also discovered that the <strong><em>File/Rolling File logging provider is still not available through the framework </em></strong>and we need to rely on external solutions like Serilog.</p>



<p></p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>Microsoft recommends using a third-party logger framework like a <strong><a rel="noreferrer noopener" href="https://www.thecodebuzz.com/file-rolling-file-logging-net-core-console-application/" target="_blank">Serilog </a></strong>or <strong><a rel="noreferrer noopener" aria-label="NLog  (opens in a new tab)" href="https://www.thecodebuzz.com/file-logging-nlog-asp-net-core/" target="_blank">NLog</a></strong> or <a href="https://www.thecodebuzz.com/log4net-file-logging-console-logging-asp-net-core/" target="_blank" rel="noreferrer noopener"><strong>Log4Net </strong></a>for other high-end logging requirements like <strong>Database or File/Rolling File logging</strong>.</p>
</blockquote>



<p></p>



<p>In this post, we will understand, how to enable <strong>file/ rolling file</strong> logging in <strong>using Serilog </strong>and do customization to existing behavior using an example. </p>



<p></p>



<h2 class="wp-block-heading" id="aioseo-getting-started"><strong>Getting started </strong></h2>



<p></p>



<h3 class="wp-block-heading" id="aioseo-create-an-asp-net-core-api-using-net-core-3-1-or-net-5"><strong>Create an ASP.NET Core API using .NET Core 3.1 or .NET </strong>6</h3>



<p></p>



<figure class="wp-block-image is-resized"><img loading="lazy" decoding="async" width="1818" height="774" src="https://i2.wp.com/thecodebuzz.com/wp-content/uploads/2019/10/Serilog-file-logging-net-core.jpg?fit=785%2C334&amp;ssl=1" alt="File Logging in ASP.NET Core 5" class="wp-image-5970" srcset="https://thecodebuzz.com/wp-content/uploads/2019/10/Serilog-file-logging-net-core.jpg 1818w, https://thecodebuzz.com/wp-content/uploads/2019/10/Serilog-file-logging-net-core-300x128.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2019/10/Serilog-file-logging-net-core-1024x436.jpg 1024w, https://thecodebuzz.com/wp-content/uploads/2019/10/Serilog-file-logging-net-core-768x327.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2019/10/Serilog-file-logging-net-core-1536x654.jpg 1536w, https://thecodebuzz.com/wp-content/uploads/2019/10/Serilog-file-logging-net-core-785x334.jpg 785w" sizes="auto, (max-width: 1818px) 100vw, 1818px" /></figure>



<p></p>



<p></p>



<p><br>Please add below NuGet Packages,</p>



<p></p>



<p>Please use the latest available version available for the ASP.NET Core version.</p>



<p></p>



<p>To set the Serilog log as a logging provider for logging purposes, please add below NuGet package,</p>



<p></p>



<pre class="wp-block-preformatted has-medium-font-size">PM&gt; Install-Package Serilog.AspNetCore -Version 3.2.0
</pre>



<p class="has-medium-font-size"></p>



<p><strong><em>Note: </em></strong><em><strong>Please use the latest Nuget version available</strong></em></p>



<p></p>



<p>The above package will help to target <strong><em>Serilog </em></strong>as a logging provider. </p>



<p></p>



<p>Now hereafter depending on the type of provider support adding Serilog will help you log in to that source. </p>



<p><strong>Examples</strong>.  <em>Console or File logging</em></p>



<p></p>



<p>Here below we will see how to enable File logging,</p>



<p></p>



<p>For Rolling File logging- </p>



<p></p>



<pre class="wp-block-preformatted has-cyan-bluish-gray-background-color has-background">  Install-Package Serilog.Sinks.RollingFile -Version 3.3.0 </pre>



<p></p>



<p>For Regular File logging-</p>



<p></p>



<pre class="wp-block-preformatted has-cyan-bluish-gray-background-color has-background">Install-Package Serilog.Sinks.File</pre>



<p></p>



<p>Or </p>



<p></p>



<p>Please install the above packages through Nuget Package Manager,</p>



<p></p>



<figure class="wp-block-image is-resized"><img loading="lazy" decoding="async" width="1887" height="924" src="https://i2.wp.com/thecodebuzz.com/wp-content/uploads/2019/10/File-logging-in-.NET-Core-using-serilog.jpg?fit=785%2C384&amp;ssl=1" alt="File Logging in .NET 5" class="wp-image-5968" srcset="https://thecodebuzz.com/wp-content/uploads/2019/10/File-logging-in-.NET-Core-using-serilog.jpg 1887w, https://thecodebuzz.com/wp-content/uploads/2019/10/File-logging-in-.NET-Core-using-serilog-300x147.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2019/10/File-logging-in-.NET-Core-using-serilog-1024x501.jpg 1024w, https://thecodebuzz.com/wp-content/uploads/2019/10/File-logging-in-.NET-Core-using-serilog-768x376.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2019/10/File-logging-in-.NET-Core-using-serilog-1536x752.jpg 1536w, https://thecodebuzz.com/wp-content/uploads/2019/10/File-logging-in-.NET-Core-using-serilog-785x384.jpg 785w" sizes="auto, (max-width: 1887px) 100vw, 1887px" /></figure>



<p></p>



<h3 class="wp-block-heading" id="aioseo-update-main-method"><strong>Update Main() method</strong></h3>



<p></p>



<p>Please update the Main method for adding the rolling file as shown in the below-highlighted code in the <em>Program.cs</em></p>



<p></p>



<h2 class="wp-block-heading" id="aioseo-main-method-in-asp-net-core-3-1-and-above-framework">The main method in ASP.NET Core 3.1 and the above framework</h2>



<p></p>



<p>Please create logger configuration as below,</p>



<p></p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: csharp; title: ; notranslate">
//
public static void Main(string&#x5B;] args)
        {

            Log.Logger = new LoggerConfiguration()
            .WriteTo.RollingFile(&quot;Thecodebuzz-log-{Date}.txt&quot;)
            .CreateLogger();
            CreateHostBuilder(args).Build().Run();

            Log.CloseAndFlush();
        }
</pre></div>


<p></p>



<p></p>



<h2 class="wp-block-heading" id="aioseo-basic-file-logging"><strong>Basic</strong> <strong>File Logging</strong></h2>



<p></p>



<p>For basic file, logging create the logger configuration as below (for both asp.net core 2.2 and 3.1)</p>



<p></p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
 Log.Logger = new LoggerConfiguration()
            .WriteTo.File(&quot;Thecodebuzz-log-{Date}.txt&quot;)
            .CreateLogger();
</pre></div>


<p></p>



<h3 class="wp-block-heading" id="aioseo-update-host-builder-asp-net-core-api-pipeline">Update Host Builder ASP.NET Core API Pipeline</h3>



<p></p>



<p>Please update the <em><strong>CreateHostBuilder</strong>()</em> method for Serilog as below,</p>



<p></p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: csharp; highlight: [6]; title: ; notranslate">
public static IHostBuilder CreateHostBuilder(string&#x5B;] args) =&gt;
            Host.CreateDefaultBuilder(args)
                .ConfigureWebHostDefaults(webBuilder =&gt;
                {
                    webBuilder.UseStartup&lt;Startup&gt;();
                }).UseSerilog();
</pre></div>


<p></p>



<p></p>



<p>Now you are all set to use Serilog in ASP.NET Core!!</p>



<p></p>



<p>Let&#8217;s now log in to Controller using the regular <strong>ILogger </strong>Interface.</p>



<p></p>



<p>Here below controller uses<strong> the <em>ILogger</em></strong> interface using dependency injection.</p>



<p></p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: csharp; title: ; notranslate">
    //
    &#x5B;Route(&quot;api/&#x5B;controller]&quot;)]
    &#x5B;ApiController]
    public class TestController : ControllerBase
    {
        private readonly ILogger _logger;

        public TestController(ILogger&lt;TestController&gt; logger)
        {
            _logger = logger;
        }
        // GET api/values
        &#x5B;HttpGet(&quot;{id}&quot;)]
        public ActionResult&lt;IEnumerable&lt;string&gt;&gt; Get(int id)
        {
            _logger.LogInformation(&quot;Start : Getting item details for {ID}&quot;, id);

            List&lt;string&gt; list = new List&lt;string&gt;();
            list.Add(&quot;A&quot;);
            list.Add(&quot;B&quot;);

            _logger.LogInformation(&quot;Completed : Item details for {ID}&quot;, list);
            return list;
        }
    }

</pre></div>


<p></p>



<p>Once the code is executed the file will be created in the project directory and logging will be captured as shown below figure.</p>



<p> </p>



<p>You can enable logging on any controller or any other layer of your API like the Business or domain layer easily. Also as shown above logging can be enabled on <em><strong>Startup.cs</strong></em> and Program.cs files as well.</p>



<p></p>



<p>Below is an example of file logging created by Serilog,</p>



<p></p>



<figure class="wp-block-image is-resized"><img loading="lazy" decoding="async" width="1902" height="871" src="https://i0.wp.com/thecodebuzz.com/wp-content/uploads/2019/05/image-53.png?fit=785%2C360&amp;ssl=1" alt="" class="wp-image-3550" srcset="https://thecodebuzz.com/wp-content/uploads/2019/05/image-53.png 1902w, https://thecodebuzz.com/wp-content/uploads/2019/05/image-53-300x137.png 300w, https://thecodebuzz.com/wp-content/uploads/2019/05/image-53-1024x469.png 1024w, https://thecodebuzz.com/wp-content/uploads/2019/05/image-53-768x352.png 768w, https://thecodebuzz.com/wp-content/uploads/2019/05/image-53-1536x703.png 1536w, https://thecodebuzz.com/wp-content/uploads/2019/05/image-53-785x359.png 785w" sizes="auto, (max-width: 1902px) 100vw, 1902px" /></figure>



<p></p>



<p>Please note the logging configuration will be used as-is from the default configuration i.e. specified in the apsetting.json.</p>



<p></p>



<p><strong><em><a href="https://www.thecodebuzz.com/createdefaultbuilder-configuration-management-net-core-and-asp-net-core/" target="_blank" rel="noreferrer noopener">CreateDefualtBuiilder</a> </em></strong>which helps to create a generic web host builder sets up the default configuration and loads the <em><strong>appsettings.json </strong></em>configuration.</p>



<p></p>



<p>All the logs will be logged based on the <strong>Log level severity</strong> specified in the <strong><em>apsetting.json </em></strong>file for the logger.</p>



<p></p>



<p>Example :</p>



<p></p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
 &quot;Logging&quot;: {
    &quot;LogLevel&quot;: {
      &quot;Default&quot;: &quot;Warning&quot;,
    }
  }
</pre></div>


<p></p>



<p>For the above logging configuration, only &#8220;<strong><em>Warning</em></strong>&#8221; above logs will be logged to a file.</p>



<p></p>



<p>Similarly for the below configuration Information and the above log level will be logged.</p>



<p> </p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
 &quot;Logging&quot;: {
    &quot;LogLevel&quot;: {
      &quot;Default&quot;: &quot;Information&quot;,
    }
  }
</pre></div>


<p></p>



<p>Serilog can also be used to override default configuration easily.</p>



<p></p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p><em><strong>What is a Rolling file? </strong></em></p>



<p>By configuring the log file as rolling, you get the capability to create a logging file based on <strong><em>dates </em></strong>or <em><strong>file size or name format,</strong></em> and many more custom options. Your file keeps rolling as per provided criteria.</p>
</blockquote>



<p></p>



<p></p>



<p>One can use the same concept for <a href="https://www.thecodebuzz.com/file-rolling-file-logging-net-core-console-application/" target="_blank" rel="noreferrer noopener">.<strong><em>NET Core Console/Desktop Application logging</em></strong></a> as well.</p>



<p></p>



<p>Other useful references :</p>



<p></p>



<ul class="wp-block-list">
<li><strong><em><a href="https://www.thecodebuzz.com/logging-in-net-core-2/" target="_blank" rel="noreferrer noopener">Logging in ASP.NET Core using Built-in provider</a></em></strong></li>



<li><strong><em><a href="https://www.thecodebuzz.com/file-logging-nlog-asp-net-core/" target="_blank" rel="noreferrer noopener">File Logging using NLog in ASP.NET Core </a></em></strong></li>
</ul>



<p></p>



<p></p>



<p style="font-size:18px">Do you have any <strong>comments or ideas or any better </strong>suggestions to share?</p>



<p class="has-small-font-size"></p>



<p style="font-size:18px">Please sound off your comments below.</p>



<p class="has-medium-font-size"></p>



<p class="has-medium-font-size"><strong>Happy Coding </strong>!!</p>



<p></p>



<p></p>



<h2 class="wp-block-heading" id="aioseo-summary">Summary</h2>



<p></p>



<p>File/Rolling file logging provider is not yet available through the .NET Core framework and certainly, we need to depend on custom or any existing external solutions.  </p>



<p></p>



<p>It&#8217;s very easy to configure file logging in .NET Core WebAPI using <strong>Serilog</strong>. Serilog helps us enable logging in a few simple steps and address the file-based logging need easily.</p>



<p></p>



<hr>



<p class=""></p>



<p class="has-background" style="background-color:#b6d9ac;font-size:18px"><br>Please <strong><em>bookmark </em></strong>this page and <em><strong>share </strong></em>it with your friends.                                                    Please <a href="https://www.thecodebuzz.com/subscription/" target="_blank" rel="noreferrer noopener"><em><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-luminous-vivid-orange-color"><strong>Subscribe</strong> </mark></em></a>to the blog to receive notifications on freshly published (2025) best practices and guidelines for software design and development.</p>




<br>



<hr>



<p class=""></p><p>The post <a href="https://thecodebuzz.com/file-logging-in-net-core-2-2-and-net-core-3-0/">SeriLog Logging in ASP.NET Core with examples</a> first appeared on <a href="https://thecodebuzz.com">TheCodeBuzz</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://thecodebuzz.com/file-logging-in-net-core-2-2-and-net-core-3-0/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
			</item>
		<item>
		<title>Top 10 Differences &#8211; Kafka Vs Rabbit MQueue in Event-driven Architecture</title>
		<link>https://thecodebuzz.com/kafka-vs-rabbit-mqueue-in-event-driven-architecture-top-10-difference/</link>
					<comments>https://thecodebuzz.com/kafka-vs-rabbit-mqueue-in-event-driven-architecture-top-10-difference/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sun, 13 Aug 2023 15:03:26 +0000</pubDate>
				<category><![CDATA[API Best Practices]]></category>
		<category><![CDATA[Event Driven Architecture]]></category>
		<category><![CDATA[Streaming]]></category>
		<category><![CDATA[Kafka Vs Rabbit MQueue in Event-driven Architecture]]></category>
		<guid isPermaLink="false">https://www.thecodebuzz.com/?p=27815</guid>

					<description><![CDATA[<p>Kafka Vs Rabbit MQueue in Event-driven Architecture Today in this article, we will learn the top 10 differences between Kafka Vs Rabbit MQueue in Event-driven Architecture. RabbitMQ, an open-source message broker, offers flexible messaging patterns like publish-subscribe, point-to-point, and request-response. It focuses on ensuring reliable message delivery between components. RabbitMQ is well-suited for scenarios requiring [&#8230;]</p>
<p>The post <a href="https://thecodebuzz.com/kafka-vs-rabbit-mqueue-in-event-driven-architecture-top-10-difference/">Top 10 Differences – Kafka Vs Rabbit MQueue in Event-driven Architecture</a> first appeared on <a href="https://thecodebuzz.com">TheCodeBuzz</a>.</p>]]></description>
										<content:encoded><![CDATA[<h1 class="wp-block-heading"><strong>Kafka Vs Rabbit MQueue in Event-driven Architecture</strong></h1>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" width="1024" height="404" src="https://www.thecodebuzz.com/wp-content/uploads/2023/08/Kafka-vs-RabbitMQ-1024x404.jpg" alt="" class="wp-image-28134" style="width:885px;height:349px" srcset="https://thecodebuzz.com/wp-content/uploads/2023/08/Kafka-vs-RabbitMQ-1024x404.jpg 1024w, https://thecodebuzz.com/wp-content/uploads/2023/08/Kafka-vs-RabbitMQ-300x118.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2023/08/Kafka-vs-RabbitMQ-768x303.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2023/08/Kafka-vs-RabbitMQ-785x310.jpg 785w, https://thecodebuzz.com/wp-content/uploads/2023/08/Kafka-vs-RabbitMQ.jpg 1156w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>Today in this article, we will learn the top 10 differences between<strong> Kafka Vs Rabbit </strong>MQueue in Event-driven Architecture.</p>



<p></p>



<div data-schema-only="false" class="wp-block-aioseo-faq"><h3 class="aioseo-faq-block-question">What is Event-Driven Architecture<br></h3><div class="aioseo-faq-block-answer">
<p><strong>Event-driven architecture (EDA) </strong>is a design approach that emphasizes the flow of events and messages between different components or services in a system. Kafka and RabbitMQ are both popular messaging systems that facilitate the implementation of event-driven architectures.</p>
</div></div>



<p></p>



<p><strong>RabbitMQ, </strong>an open-source message broker, offers flexible messaging patterns like publish-subscribe, point-to-point, and request-response. </p>



<p></p>



<p>It focuses on ensuring reliable message delivery between components. RabbitMQ is well-suited for scenarios requiring guaranteed message delivery and queue management, such as task distribution, load leveling, and communication between microservices.</p>



<p></p>



<p><strong><a href="https://kafka.apache.org/downloads" target="_blank" rel="noopener" title="">Kafka</a>,</strong> developed by Apache, excels at handling high-throughput, real-time data streaming. </p>



<p></p>



<p>It acts as a distributed event streaming platform, where events are produced and consumed by various applications. </p>



<p>Kafka&#8217;s publish-subscribe model allows multiple consumers to subscribe to the same event stream, ensuring scalability and fault tolerance. </p>



<p></p>



<p>Its durability and fault-tolerant design make it suitable for scenarios demanding data integrity, such as log aggregation, real-time analytics, and monitoring.</p>



<p></p>



<p></p>



<p>We will cover top-level differences </p>



<p></p>



<div class="wp-block-aioseo-table-of-contents"><ul><li><a href="#aioseo-messaging-model">Messaging Model</a><ul><li><a href="#aioseo-kafka-messaging-model">Kafka Messaging Model</a></li><li><a href="#aioseo-rabbit-mq-messaging-model">Rabbit MQ Messaging Model</a></li></ul></li><li><a href="#aioseo-data-persistence-details">Data Persistence details</a><ul><li><a href="#aioseo-kafka-data-persistence-details">Kafka Data Persistence details</a></li><li><a href="#aioseo-rabbit-mq-data-persistence-details">Rabbit MQ Data Persistence details</a></li></ul></li><li><a href="#aioseo-message-delivery-guarantees">Message Delivery Guarantees</a><ul><li><a href="#aioseo-kafka-message-delivery-guarantees">Kafka Message Delivery Guarantees</a></li><li><a href="#aioseo-rabbit-mq-meesage-delivery-guararantee">Rabbit MQ Message delivery guarantee</a></li></ul></li><li><a href="#aioseo-message-order">Message Order</a><ul><li><a href="#aioseo-kafka-message-order">Kafka Message Order</a></li><li><a href="#aioseo-rabbit-mq-messge-order">Rabbit MQ messge order</a></li></ul></li><li><a href="#aioseo-scalability-and-performance">Scalability and Performance</a><ul><li><a href="#aioseo-scalability-and-performance">Kafka Scalability and Performance</a></li><li><a href="#aioseo-rabbit-mq-scalability-and-performance">Rabbit MQ Scalability and Performance</a></li></ul></li><li><a href="#aioseo-protocol-support">Protocol Support</a><ul><li><a href="#aioseo-kafka-protocol-support">Kafka Protocol Support</a></li><li><a href="#aioseo-rabbit-mq-protocol">Rabbit MQ Protocol</a></li></ul></li></ul></div>



<p></p>



<h2 class="wp-block-heading" id="aioseo-messaging-model"><strong>Messaging Model</strong></h2>



<p></p>



<h3 class="wp-block-heading" id="aioseo-kafka-messaging-model">Kafka Messaging Model</h3>



<p></p>



<ul class="wp-block-list">
<li>Kafka follows a publish-subscribe message model which is based on the push/pull model. Here subscriber doesn&#8217;t get notified automatically of the event. Here the client(Consumer) keeps polling for the data to retrieve the available message based on the consumer group.</li>



<li>The key elements of Kafka&#8217;s message model are:
<ul class="wp-block-list">
<li><strong>Topics</strong>: Messages in Kafka are organized into topics, which are named feeds or categories to which messages are published. Topics represent a specific stream of records, similar to a table in a database or a folder in a file system.</li>



<li><strong>Producers</strong>: Producers are responsible for publishing messages to Kafka topics. They write data records to specific topics and determine the partition to which each record is sent. Producers can be part of a single application or distributed across multiple systems.</li>



<li><strong>Partitions</strong>: Each topic in Kafka is divided into one or more partitions, which are ordered and immutable sequences of records. Partitions allow for parallelism and scalability by distributing the load across multiple brokers and enabling concurrent processing of messages.</li>



<li><strong>Brokers</strong>: Kafka relies on a cluster of servers called brokers, which handle the storage and replication of message data. Each broker can be responsible for one or more partitions. Brokers work together to form a distributed and fault-tolerant message processing system.</li>



<li><strong>Consumers</strong>: Consumers read messages from Kafka topics. They can <a href="https://www.thecodebuzz.com/redis-publish-subscribe-messages-redis-net-core-csharp/">subscribe to one or more topics and consume messages</a> from one or more partitions. Consumers maintain their own offset, which represents the position or progress within a partition, allowing for independent and scalable message consumption.</li>



<li><strong>Consumer Groups</strong>: Consumers can be organized into consumer groups. Each consumer within a group reads from a different subset of partitions, enabling parallel processing of messages within a topic. Consumer groups provide scalability and fault tolerance by distributing the workload across multiple consumers.</li>



<li><strong>Retention</strong>: Kafka retains messages in topics for a configurable period or based on size limits. This retention period allows for replaying and reprocessing of messages, enabling systems to handle real-time and historical data consumption.</li>



<li>Stream Processing: Kafka&#8217;s message model supports stream processing, which involves the continuous processing of messages in real-time. Kafka Streams and other stream processing frameworks built on top of Kafka allow for stateful transformations, aggregations, and analytics on streaming data.</li>



<li>The publish-subscribe message model in Kafka provides a highly scalable and fault-tolerant architecture for handling streams of records. It allows for real-time processing, event-driven architectures, log aggregation, and building data pipelines that can handle large volumes of data efficiently.</li>
</ul>
</li>
</ul>



<p></p>



<h3 class="wp-block-heading" id="aioseo-rabbit-mq-messaging-model">Rabbit MQ Messaging Model</h3>



<p></p>



<p>RabbitMQ follows a traditional message queueing model. The key elements of RabbitMQ&#8217;s messaging model are as follows:</p>



<p></p>



<ul class="wp-block-list">
<li><strong>Exchanges</strong>: Exchanges receive messages from producers and route them to the appropriate queues based on predefined rules. Exchanges use different routing algorithms (e.g., direct, topic, fanout, headers) to determine how messages are distributed.</li>



<li><strong>Queues</strong>: Queues store messages until they are consumed by consumers. Messages are typically sent to a specific queue based on routing rules defined by exchanges. Queues can be created dynamically or pre-declared, and they retain messages until they are explicitly acknowledged or expired.</li>



<li><strong>Producers</strong>: Producers are responsible for creating and sending messages to RabbitMQ exchanges. They publish messages to specific exchanges, often specifying a routing key that helps determine the routing rules for message distribution.</li>



<li><strong>Consumers</strong>: Consumers retrieve and process messages from RabbitMQ queues. They subscribe to specific queues and <strong>receive messages as they become available</strong>. Consumers acknowledge the successful processing of messages to remove them from the queues.</li>



<li><strong>Binding</strong>: Bindings connect exchanges to queues based on routing rules. They define the relationship between exchanges and queues, determining how messages flow from exchanges to queues for eventual consumption by consumers.</li>
</ul>



<p></p>



<h2 class="wp-block-heading" id="aioseo-data-persistence-details"><strong>Data Persistence details</strong></h2>



<p></p>



<h3 class="wp-block-heading" id="aioseo-kafka-data-persistence-details">Kafka Data Persistence details</h3>



<p></p>



<ul class="wp-block-list">
<li>Kafka&#8217;s data persistence capabilities make it well-suited for use cases that involve storing and processing large volumes of <em><strong>data streams, event sourcing, log aggregation, and building real-time data pipelines</strong></em>.</li>
</ul>



<p></p>



<ul class="wp-block-list">
<li>The combination of disk-based storage, replication, and configurable retention policies provides durability, fault tolerance, and scalability for reliable message handling.</li>
</ul>



<p></p>



<h3 class="wp-block-heading" id="aioseo-rabbit-mq-data-persistence-details">Rabbit MQ Data Persistence details</h3>



<p></p>



<ul class="wp-block-list">
<li>These features in RabbitMQ ensure data persistence and durability, making it suitable for various messaging scenarios that require reliable message storage, fault tolerance, and high availability. </li>
</ul>



<p></p>



<ul class="wp-block-list">
<li>By leveraging disk storage, journaling, replication, and clustering, RabbitMQ provides robust persistence capabilities to handle messaging needs in distributed systems.</li>
</ul>



<p></p>



<h2 class="wp-block-heading" id="aioseo-message-delivery-guarantees"><strong>Message Delivery Guarantees</strong></h2>



<p></p>



<h3 class="wp-block-heading" id="aioseo-kafka-message-delivery-guarantees">Kafka Message Delivery Guarantees</h3>



<p></p>



<p><strong>Kafka </strong>provides configurable message delivery guarantees to ensure reliable and fault-tolerant processing of messages. </p>



<p></p>



<p>It&#8217;s important to note that achieving exactly-once delivery requires coordination and careful implementation by both producers and consumers. Producers need to manage transactional writes, and consumers must handle idempotent processing to handle duplicate messages.</p>



<p></p>



<p><strong>Kafka&#8217;s </strong>delivery guarantees, coupled with features like message replication, fault tolerance, and data persistence, make it suitable for building reliable data pipelines, event-driven architectures, and stream processing systems. The configurable delivery semantics allow developers to choose the appropriate level of reliability based on their specific application requirements.</p>



<p></p>



<h3 class="wp-block-heading" id="aioseo-rabbit-mq-meesage-delivery-guararantee">Rabbit MQ Message delivery guarantee </h3>



<p></p>



<ul class="wp-block-list">
<li><strong>RabbitMQ </strong>provides flexible message delivery guarantees to ensure reliable and consistent messaging between producers and consumers. </li>
</ul>



<p></p>



<ul class="wp-block-list">
<li>The message delivery guarantees in RabbitMQ can be summarized as follows.RabbitMQ&#8217;s delivery guarantees, combined with features like durable message storage, message acknowledgments, and publisher confirms, provide a solid foundation for building reliable and resilient messaging systems. </li>
</ul>



<p></p>



<ul class="wp-block-list">
<li>The application Team can choose the appropriate level of delivery guarantees based on their application requirements, considering factors such as message importance, performance, and complexity of achieving exactly-once semantics.</li>
</ul>



<p></p>



<p></p>



<h2 class="wp-block-heading" id="aioseo-message-order"><strong>Message Order</strong></h2>



<p></p>



<h3 class="wp-block-heading" id="aioseo-kafka-message-order">Kafka Message Order </h3>



<p></p>



<p><strong>Kafka </strong>ensures message order within a partition, providing a strong guarantee of message ordering at the partition level. The ordering of messages in Kafka can be summarized as follows:</p>



<p></p>



<p>It&#8217;s important to note that while Kafka guarantees message order within a partition, it does not provide global ordering across multiple partitions. </p>



<p></p>



<p>When processing messages from multiple partitions, the order of messages is not guaranteed unless additional ordering mechanisms are implemented at the application level.</p>



<p></p>



<p>By leveraging Kafka&#8217;s partitioning and ordering guarantees, applications can process and analyze data streams while maintaining the sequence and integrity of messages within each partition. </p>



<p></p>



<p>This capability is particularly valuable in scenarios where maintaining message order is crucial, such as event sourcing, stream processing, and building reliable data pipelines.</p>



<p></p>



<h3 class="wp-block-heading" id="aioseo-rabbit-mq-messge-order">Rabbit MQ messge order</h3>



<p></p>



<p><strong>RabbitMQ </strong>maintains the order of messages. Messages are delivered to consumers in the order they were published to the queue, ensuring sequential processing within that specific queue.</p>



<p></p>



<p>By default, RabbitMQ delivers messages to consumers as soon as they become available in the queue. </p>



<p></p>



<p>To achieve global message ordering across multiple queues or consumers in RabbitMQ, you would need to implement additional mechanisms at the application level. </p>



<p></p>



<p></p>



<p>One approach is to use a single queue and have a single consumer process messages in a serial manner. This ensures strict ordering but sacrifices parallel processing capabilities.</p>



<p></p>



<p>Alternatively, you can introduce message sequencing or use message properties to include a sequence number that allows consumers to order messages appropriately based on their processing logic. This requires coordination and synchronization between producers and consumers to ensure correct sequencing.</p>



<p></p>



<h2 class="wp-block-heading" id="aioseo-scalability-and-performance"><strong>Scalability and Performance</strong></h2>



<p></p>



<h3 class="wp-block-heading" id="aioseo-scalability-and-performance">Kafka Scalability and Performance</h3>



<p></p>



<p><strong>Kafka </strong>is designed to provide high scalability and handle large-scale data streaming and processing. Its architecture and features contribute to its scalability. </p>



<p></p>



<p>Kafka operates in a distributed manner, allowing it to scale horizontally by adding more servers or brokers to the Kafka cluster. Each broker handles a subset of the data and partitions, enabling parallel processing and increased throughput.</p>



<p></p>



<p>Kafka allows for dynamic scaling of the cluster by adding or removing brokers without interrupting the data flow. This flexibility enables capacity adjustment based on traffic patterns and evolving system requirements.</p>



<p></p>



<p>Kafka&#8217;s design emphasizes high throughput and low latency. It can handle millions of messages per second and provides near-real-time processing capabilities, making it suitable for demanding workloads.</p>



<p></p>



<p></p>



<h3 class="wp-block-heading" id="aioseo-rabbit-mq-scalability-and-performance">Rabbit MQ Scalability and Performance</h3>



<p></p>



<p><strong>RabbitMQ </strong>offers scalability and performance features that allow it to handle increasing message loads and ensure efficient message processing</p>



<p></p>



<p>RabbitMQ supports clustering, where multiple RabbitMQ nodes can form a cluster. Clustering enables horizontal scalability by distributing message processing across multiple nodes. Each node in the cluster can handle a portion of the message traffic, allowing for increased throughput and fault tolerance.</p>



<p></p>



<p>RabbitMQ supports connection pooling, allowing multiple clients to share connections to the RabbitMQ broker. Connection pooling minimizes overhead and improves performance by reusing established connections rather than creating new connections for each client.</p>



<p></p>



<p>Kafka&#8217;s scalability enables it to handle demanding use cases, including real-time data processing, event streaming, log aggregation, and building distributed systems. By leveraging its distributed architecture, partitioning, replication, and dynamic scaling capabilities, Kafka can accommodate growing data volumes and support high-performance data streaming applications.</p>



<p></p>



<h2 class="wp-block-heading" id="aioseo-protocol-support"><strong>Protocol Support</strong></h2>



<p></p>



<h3 class="wp-block-heading" id="aioseo-kafka-protocol-support">Kafka Protocol Support</h3>



<p></p>



<p>Kafka supports its <strong><em>own proprietary protoco</em></strong>l and provides client libraries for different programming languages, making it accessible and interoperable with various systems. </p>



<p></p>



<p>Kafka uses its own custom binary protocol for communication between clients and the Kafka brokers.</p>



<p>The protocol is designed to be efficient, lightweight, and optimized for high-performance data streaming.</p>



<p></p>



<p>Kafka&#8217;s wire-level protocol is TCP-based, providing reliable and ordered message delivery over the network.</p>



<p></p>



<h3 class="wp-block-heading" id="aioseo-rabbit-mq-protocol">Rabbit MQ Protocol </h3>



<p></p>



<ul class="wp-block-list">
<li><strong>Advanced Message Queuing Protocol (AMQP)</strong>:
<ul class="wp-block-list">
<li>RabbitMQ is based on the AMQP protocol, an open standard for messaging systems.</li>



<li>RabbitMQ supports different versions of the AMQP protocol, including AMQP 0-9-1, AMQP 0-10, and AMQP 1.0.</li>
</ul>
</li>



<li><strong>Simple/Streaming Text-Oriented Messaging Protocol (STOMP)</strong>:
<ul class="wp-block-list">
<li>RabbitMQ provides support for the STOMP protocol, which is a text-based protocol for messaging interoperability.</li>
</ul>
</li>
</ul>



<p></p>



<ul class="wp-block-list">
<li><strong>Message Queue Telemetry Transport (MQTT)</strong>:
<ul class="wp-block-list">
<li>RabbitMQ offers MQTT protocol support, which is a lightweight and efficient publish-subscribe messaging protocol.</li>
</ul>
</li>
</ul>



<p></p>



<ul class="wp-block-list">
<li>HTTP/REST APIs:
<ul class="wp-block-list">
<li>RabbitMQ provides HTTP-based APIs for administrative operations, management, and monitoring of the RabbitMQ broker.</li>



<li>These APIs enable programmatic access to control and monitor RabbitMQ using standard HTTP/REST methods.</li>
</ul>
</li>
</ul>



<p></p>



<ul class="wp-block-list">
<li>WebSockets:
<ul class="wp-block-list">
<li>RabbitMQ supports WebSockets, which allow full-duplex communication over a single TCP connection, providing real-time and interactive messaging capabilities.</li>



<li>WebSockets are commonly used in web and mobile applications to enable real-time updates and push notifications.</li>
</ul>
</li>
</ul>



<p></p>



<p>These top 10 differences provide a high-level overview of Kafka and RabbitMQ, covering aspects such as messaging model, data persistence, delivery guarantees, scalability, protocol support, use cases, ecosystem, fault tolerance, and learning curve. </p>



<p></p>



<p>In an event-driven architecture,<strong> Kafka and RabbitMQ</strong> play vital roles as intermediaries that facilitate communication between disparate services. </p>



<p></p>



<p>Kafka&#8217;s strengths lie in real-time event streaming, making it a backbone for applications with high data throughput. RabbitMQ shines in guaranteeing reliable message delivery, making it a solid choice for scenarios where message integrity is paramount. </p>



<p></p>



<p>The selection between Kafka and RabbitMQ depends on the specific requirements of the application, with Kafka favored for high-volume, real-time data streaming and RabbitMQ for reliable message-based communication.</p>



<p></p>



<p>Consider these distinctions when choosing the messaging system that best aligns with your project requirements.</p>



<p></p>



<hr>



<p class=""></p>



<p class="has-background" style="background-color:#b6d9ac;font-size:18px"><br>Please <strong><em>bookmark </em></strong>this page and <em><strong>share </strong></em>it with your friends.                                                    Please <a href="https://www.thecodebuzz.com/subscription/" target="_blank" rel="noreferrer noopener"><em><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-luminous-vivid-orange-color"><strong>Subscribe</strong> </mark></em></a>to the blog to receive notifications on freshly published (2025) best practices and guidelines for software design and development.</p>




<br>



<hr>



<p class=""></p>



<p></p><p>The post <a href="https://thecodebuzz.com/kafka-vs-rabbit-mqueue-in-event-driven-architecture-top-10-difference/">Top 10 Differences – Kafka Vs Rabbit MQueue in Event-driven Architecture</a> first appeared on <a href="https://thecodebuzz.com">TheCodeBuzz</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://thecodebuzz.com/kafka-vs-rabbit-mqueue-in-event-driven-architecture-top-10-difference/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Top 10 Best Practices for CORS</title>
		<link>https://thecodebuzz.com/top-10-best-practices-cors-cross-origin-resource-sharing/</link>
					<comments>https://thecodebuzz.com/top-10-best-practices-cors-cross-origin-resource-sharing/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sun, 06 Aug 2023 03:45:57 +0000</pubDate>
				<category><![CDATA[API Best Practices]]></category>
		<category><![CDATA[Top 10 Best Practices for CORS]]></category>
		<guid isPermaLink="false">https://www.thecodebuzz.com/?p=28109</guid>

					<description><![CDATA[<p>Top 10 Best Practices for CORS &#8211; Cross-Origin Resource Sharing Today, this article will help you to go over the Top 10 Best Practices for CORS -Cross-Origin Resource Sharing. By design, Web applications execute a cross-origin HTTP request when it requests a resource that has a different origin or domain. This is due to security [&#8230;]</p>
<p>The post <a href="https://thecodebuzz.com/top-10-best-practices-cors-cross-origin-resource-sharing/">Top 10 Best Practices for CORS</a> first appeared on <a href="https://thecodebuzz.com">TheCodeBuzz</a>.</p>]]></description>
										<content:encoded><![CDATA[<h1 class="wp-block-heading"><strong>Top 10 Best Practices for CORS &#8211; Cross-Origin Resource Sharing</strong></h1>



<figure class="wp-block-image size-large is-resized"><a href="https://www.thecodebuzz.com/enable-cors-asp-net-core/" target="_blank" rel="noreferrer noopener"><img loading="lazy" decoding="async" width="1024" height="464" src="https://www.thecodebuzz.com/wp-content/uploads/2020/05/Add-CORS-in-.NET-Core-Best-Practices-1024x464.jpg" alt="Top 10 Best Practices for CORS -Cross-Origin Resource Sharing" class="wp-image-10762" srcset="https://thecodebuzz.com/wp-content/uploads/2020/05/Add-CORS-in-.NET-Core-Best-Practices-1024x464.jpg 1024w, https://thecodebuzz.com/wp-content/uploads/2020/05/Add-CORS-in-.NET-Core-Best-Practices-300x136.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2020/05/Add-CORS-in-.NET-Core-Best-Practices-768x348.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2020/05/Add-CORS-in-.NET-Core-Best-Practices-785x356.jpg 785w, https://thecodebuzz.com/wp-content/uploads/2020/05/Add-CORS-in-.NET-Core-Best-Practices.jpg 1108w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></figure>



<p>Today, this article will help you to go over the Top 10 Best Practices for CORS -Cross-Origin Resource Sharing.</p>



<p></p>



<p>By design, Web applications execute a cross-origin HTTP request when it requests a resource that has a different origin or domain. This is due to security reasons and as per design specifications. </p>



<p> </p>



<div data-schema-only="false" class="wp-block-aioseo-faq" id="aioseo-what-is-cors"><h3 class="aioseo-faq-block-question">What is CORS </h3><div class="aioseo-faq-block-answer">
<p>CORS (<strong><em>Cross-origin resource sharing</em></strong>) is a security feature that limits how web pages can communicate with resources from other domains.</p>



<p>Web browsers are required to use CORS by design. Implementing the same-origin policy, which prohibits web pages from making requests to domains other than their own, prevents unwanted access to resources.</p>



<p>Better Controlled cross-origin requests are made possible by CORS, which enables servers to specify which origins (domains) are permitted access to their resources. As a result, users are shielded from potential security threats like cross-site request forgery (CSRF) and cross-site scripting (XSS) attacks while enabling safe communication between various origins.</p>



<p></p>



<p>Today in this article, we will go over below aspects,</p>



<p></p>
</div></div>



<div class="wp-block-aioseo-table-of-contents"><ul><li><a href="#aioseo-enable-cors-on-the-server">Enable CORS on the Server</a><ul><li><a href="#aioseo-example-net-c">Example &#8211; .NET C#</a></li><li><a href="#aioseo-example-node-js">Example &#8211; Node.js</a></li><li><a href="#aioseo-example-java">Example &#8211; Java</a></li></ul></li><li><a href="#aioseo-restrict-origins-in-cors">Restrict Origins in CORS</a><ul><li><a href="#aioseo-example-net-c">Example &#8211; .NET C#</a></li><li><a href="#aioseo-example-node-js">Example &#8211; Node.js</a></li><li><a href="#aioseo-example-java">Example &#8211; Java</a></li></ul></li><li><a href="#aioseo-validate-user-input-or-input-request">Validate User Input or Input request</a></li><li><a href="#aioseo-handle-cors-errors">Handle CORS Errors</a></li><li><a href="#aioseo-optimize-cors-by-caching-pre-flight-requests">Optimize CORS by Caching Pre-flight Requests</a></li><li><a href="#aioseo-http-safe-methods">HTTP Safe Methods</a></li><li><a href="#aioseo-security-audits-of-cors-policy">Security Audits of CORS policy</a></li><li><a href="#aioseo-summary">Summary</a></li></ul></div>



<p></p>



<h2 class="wp-block-heading" id="aioseo-enable-cors-on-the-server"><strong>Enable CORS on the Server</strong></h2>



<p></p>



<p>Configure the server to include the necessary CORS headers in the HTTP response, allowing specific origins to access the resources.</p>



<p></p>



<h3 class="wp-block-heading" id="aioseo-example-net-c">Example &#8211; .NET C#</h3>



<p></p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; highlight: [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]; title: ; notranslate">
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
...

....
    app.UseCors(builder =&gt;
        builder.AllowAnyOrigin()
               .AllowAnyMethod()
               .AllowAnyHeader());
    
....
...
}

</pre></div>


<h3 class="wp-block-heading" id="aioseo-example-node-js">Example &#8211; Node.js </h3>



<p></p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: jscript; highlight: [1,2,3,4,5,6,7,8,9,10]; title: ; notranslate">
const express = require(&#039;express&#039;);
const app = express();
const cors = require(&#039;cors&#039;);
...
...

app.use(cors());

....
....

});

</pre></div>


<h3 class="wp-block-heading" id="aioseo-example-java">Example &#8211; Java </h3>



<p></p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: java; title: ; notranslate">
import org.springframework.web.bind.annotation.CrossOrigin;

// Enable CORS for a specific controller
@CrossOrigin(&quot;*&quot;)
@RestController
public class WeatherController {
 // ...
}

</pre></div>


<p>Above both examples we are allowing any origin, any HTTP method, and any header to access your resources. </p>



<p>For production use, consider <strong>Restrict Origins</strong> the origin to specific origins, methods, and headers to enhance security.</p>



<p></p>



<p></p>



<h2 class="wp-block-heading" id="aioseo-restrict-origins-in-cors"><strong>Restrict Origins in CORS</strong></h2>



<p></p>



<p>Only allow trusted origins to access your resources by specifying the allowed origins using the &#8220;Access-Control-Allow-Origin&#8221; header.</p>



<p>Please specify the origins that are allowed to access your server resources. </p>



<p>This will limit cross-origin requests to only those domains that you explicitly trust. </p>



<p>Depending on the server-side technology you are using, the implementation may vary, but the concept remains the same.</p>



<p></p>



<h3 class="wp-block-heading" id="aioseo-example-net-c">Example &#8211; .NET C#</h3>



<p></p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; highlight: [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]; title: ; notranslate">
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
...

....
    app.UseCors(builder =&gt;
        builder.WithOrigins(&quot;https://www.thecodebuzz.com&quot;,)
               .AllowAnyMethod()
               .AllowAnyHeader());
    
....
...
}

</pre></div>


<h3 class="wp-block-heading" id="aioseo-example-node-js">Example &#8211; Node.js </h3>



<p></p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: jscript; highlight: [1,2,3,4,5,6,7,8,9,10]; title: ; notranslate">
const express = require(&#039;express&#039;);
const app = express();
const cors = require(&#039;cors&#039;);
...
...

const allowedOrigins = &#x5B;&quot;http://TheCodebuzz.com&quot;, &quot;http://TheCodebuzz.test.com&quot;];

// Enable CORS for specific origins
app.use(cors({
    origin: function (origin, callback) {
        if (!origin || allowedOrigins.includes(origin)) {
            callback(null, true);
        } else {
            callback(new Error(&#039;Not allowed by CORS&#039;));
        }
    }
}));

....
....

});

</pre></div>


<h3 class="wp-block-heading" id="aioseo-example-java">Example &#8211; Java </h3>



<p></p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: java; title: ; notranslate">
import org.springframework.web.bind.annotation.CrossOrigin;

// Enable CORS for a specific controller
@RestController
public class WeatherController {
// Restrict origins for this specific controller
@CrossOrigin(origins = {&quot;http://TheCodebuzz.com&quot;, &quot;http://Test.TheCodebuzz.com&quot;})
 // ...
}

</pre></div>


<p></p>



<p></p>



<h2 class="wp-block-heading" id="aioseo-validate-user-input-or-input-request"><strong>Validate User Input or Input request </strong></h2>



<p></p>



<p>Sanitizing input requests in an application is crucial to prevent security vulnerabilities such as SQL injection, cross-site scripting (XSS), and other malicious attacks. </p>



<p></p>



<p>Proper input validation and sanitization help ensure the integrity and security of your application. Here&#8217;s how you can sanitize input requests in your application.</p>



<p></p>



<p>Validate all incoming data against expected formats and constraints. Reject or sanitize any input that doesn&#8217;t conform to these requirements.</p>



<p></p>



<p></p>



<h2 class="wp-block-heading" id="aioseo-handle-cors-errors"><strong>Handle CORS Errors</strong></h2>



<p></p>



<p>Cross-Origin Resource Sharing (CORS) errors occur when a web application makes a request to a different domain than the one from which the application was served. </p>



<p></p>



<p>Browsers enforce the same-origin policy to prevent unauthorized access, but CORS allows controlled access to resources from other origins. </p>



<p></p>



<p><strong>CORS </strong>handling can vary based on the programming language, framework, and server you are using.</p>



<p></p>



<p>Always refer to the documentation of your specific technology stack for accurate and detailed instructions on handling CORS.</p>



<p></p>



<p>Handle CORS errors on the server side. If a request violates CORS policies, respond with an appropriate error status (e.g., 403 Forbidden) and an error message.</p>



<p></p>



<h2 class="wp-block-heading" id="aioseo-optimize-cors-by-caching-pre-flight-requests"><strong>Optimize CORS by Caching Pre-flight Requests </strong></h2>



<p></p>



<p>Preflight requests in CORS (Cross-Origin Resource Sharing) are OPTIONS requests sent by browsers before certain cross-origin requests. </p>



<p></p>



<p>These checks determine if the actual request is safe to send. While preflight requests cannot be cached, their responses can be cached. </p>



<p></p>



<p>This can optimize subsequent CORS requests by allowing the browser to reuse the cached response without re-triggering preflight checks. </p>



<p></p>



<p>To cache preflight responses, ensure the appropriate caching headers (e.g., <code>Cache-Control</code>, <code>Expires</code>) are set in the server&#8217;s response to the OPTIONS request.</p>



<p></p>



<p></p>



<h2 class="wp-block-heading" id="aioseo-http-safe-methods"><strong>HTTP Safe Methods</strong></h2>



<p></p>



<p>Preferring safe HTTP methods for Cross-Origin Resource Sharing (CORS) is a best practice that enhances security and simplifies cross-origin communication between web applications and APIs. </p>



<p></p>



<p>Safe methods include, </p>



<ul class="wp-block-list">
<li>GET</li>



<li>HEAD</li>



<li>OPTIONS</li>
</ul>



<p>The above safe HTTP methods are considered read-only and do not modify the server state. These Safe methods are idempotent, meaning that making multiple identical requests will have the same effect as making a single.</p>



<p></p>



<h2 class="wp-block-heading" id="aioseo-security-audits-of-cors-policy"><strong>Security Audits of CORS policy </strong></h2>



<p></p>



<p>Periodically review and update CORS settings based on evolving security requirements to maintain a secure web application.</p>



<p></p>



<p>By following these best practices, you can ensure secure and controlled communication between different origins in your web applications, preventing unauthorized access and potential security risks associated with Cross-Origin Resource Sharing.</p>



<p></p>



<h2 class="wp-block-heading" id="aioseo-summary"><strong>Summary </strong></h2>



<p></p>



<p>CORS, or Cross-Origin Resource Sharing, is a security feature implemented in web browsers to control how web pages can interact with resources from different domains</p>



<p>By Adding CORS, you can ensure secure and steady communication between different origins in your web applications while preventing potential security risks associated with Cross-Origin Resource Sharing.</p>



<p></p>



<p>That&#8217;s all! Happy coding!</p>



<p></p>



<p>Does this help you fix your issue? </p>



<p></p>



<p>Do you have any better solutions or suggestions? Please sound off your comments below.</p>



<hr>



<p class=""></p>



<p class="has-background" style="background-color:#b6d9ac;font-size:18px"><br>Please <strong><em>bookmark </em></strong>this page and <em><strong>share </strong></em>it with your friends.                                                    Please <a href="https://www.thecodebuzz.com/subscription/" target="_blank" rel="noreferrer noopener"><em><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-luminous-vivid-orange-color"><strong>Subscribe</strong> </mark></em></a>to the blog to receive notifications on freshly published (2025) best practices and guidelines for software design and development.</p>




<br>



<hr>



<p class=""></p>



<p></p>



<p></p>



<p></p><p>The post <a href="https://thecodebuzz.com/top-10-best-practices-cors-cross-origin-resource-sharing/">Top 10 Best Practices for CORS</a> first appeared on <a href="https://thecodebuzz.com">TheCodeBuzz</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://thecodebuzz.com/top-10-best-practices-cors-cross-origin-resource-sharing/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>NSwag Vs Swashbuckle &#8211; What Is The Difference</title>
		<link>https://thecodebuzz.com/nswag-vs-swashbuckle-swagger-differences-openapi-rest-guidelines/</link>
					<comments>https://thecodebuzz.com/nswag-vs-swashbuckle-swagger-differences-openapi-rest-guidelines/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Tue, 01 Aug 2023 03:46:18 +0000</pubDate>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[API Best Practices]]></category>
		<category><![CDATA[nswag vs swashbuckle]]></category>
		<guid isPermaLink="false">https://www.thecodebuzz.com/?p=27947</guid>

					<description><![CDATA[<p>NSwag Vs Swashbuckle Differences &#8211; Guidelines NSwag and Swashbuckle are both popular libraries used for integrating Swagger/OpenAPI specifications with ASP.NET Core web applications. Both libraries serve similar purposes, but they have some differences in terms of features and focus. An open standard for describing and documenting APIs (Application Programming Interfaces), formerly known as Swagger, is [&#8230;]</p>
<p>The post <a href="https://thecodebuzz.com/nswag-vs-swashbuckle-swagger-differences-openapi-rest-guidelines/">NSwag Vs Swashbuckle – What Is The Difference</a> first appeared on <a href="https://thecodebuzz.com">TheCodeBuzz</a>.</p>]]></description>
										<content:encoded><![CDATA[<h1 class="wp-block-heading"><strong>NSwag Vs Swashbuckle Differences &#8211; Guidelines</strong></h1>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="548" src="https://www.thecodebuzz.com/wp-content/uploads/2023/07/Nswag-vs-Swashbuckle-1024x548.jpg" alt="NSwag Vs Swashbuckle Differences" class="wp-image-27957" srcset="https://thecodebuzz.com/wp-content/uploads/2023/07/Nswag-vs-Swashbuckle-1024x548.jpg 1024w, https://thecodebuzz.com/wp-content/uploads/2023/07/Nswag-vs-Swashbuckle-300x160.jpg 300w, https://thecodebuzz.com/wp-content/uploads/2023/07/Nswag-vs-Swashbuckle-768x411.jpg 768w, https://thecodebuzz.com/wp-content/uploads/2023/07/Nswag-vs-Swashbuckle-1536x821.jpg 1536w, https://thecodebuzz.com/wp-content/uploads/2023/07/Nswag-vs-Swashbuckle-2048x1095.jpg 2048w, https://thecodebuzz.com/wp-content/uploads/2023/07/Nswag-vs-Swashbuckle-785x420.jpg 785w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p><br><strong>NSwag </strong>and <strong>Swashbuckle </strong>are both popular libraries used for integrating Swagger/OpenAPI specifications with ASP.NET Core web applications. </p>



<p></p>



<p>Both libraries serve similar purposes, but they have some differences in terms of features and focus. </p>



<p></p>



<p>An open standard for describing and documenting APIs (Application Programming Interfaces), formerly known as Swagger, is called OpenAPI. </p>



<p></p>



<ul class="wp-block-list">
<li>It offers a machine-readable structure that makes it simple for developers to comprehend and use APIs. </li>



<li>OpenAPI enables API providers to uniformly define their API&#8217;s endpoints, request, and response parameters, authentication strategies, and other key components.</li>
</ul>



<p></p>



<p>Today in this article we will compare and contrast NSwag and Swashbuckle to help you make an informed decision on which one to use for your ASP.NET Core project.</p>



<p></p>



<div class="wp-block-aioseo-table-of-contents"><ul><li><a href="#aioseo-what-is-nswag">What is NSwag</a></li><li><a href="#aioseo-getting-started">Getting Started &#8211; NSwag Vs Swashbuckle</a></li><li><a href="#aioseo-main-feature-of-nswag">Main Feature of NSwag</a><ul><li><a href="#aioseo-automate-api-client-side-code-generation">Automate API Client-side Code Generation</a></li><li><a href="#aioseo-server-stub-generation">Server Stub Generation</a></li><li><a href="#aioseo-reverse-engineering-swagger-specification">Reverse Engineering Swagger Specification</a></li><li><a href="#aioseo-flexibility-and-customization">Flexibility and Customization</a></li><li><a href="#aioseo-cli-and-visual-studio-integration">CLI and Visual Studio Integration</a></li><li><a href="#aioseo-versatile-and-support-more-languages">Versatile and supports more languages</a></li><li><a href="#aioseo-code-generation-templates">Code Generation Templates</a></li></ul></li><li><a href="#aioseo-swashbuckle">What is Swashbuckle</a></li><li><a href="#aioseo-getting-started">Getting Started</a></li><li><a href="#aioseo-here-are-some-key-aspects-of-swashbuckle">Here are some key aspects of Swashbuckle</a><ul><li><a href="#aioseo-api-documentation-generation">API Documentation Generation</a></li><li><a href="#aioseo-interactive-swagger-ui">Interactive Swagger UI</a></li><li><a href="#aioseo-code-annotations-for-documentation">Code Annotations for Documentation</a></li><li><a href="#aioseo-customization-options">Customization Options</a></li><li><a href="#aioseo-integration-with-asp-net-core">Integration with ASP.NET Core</a></li></ul></li><li><a href="#aioseo-choosing-between-nswag-and-swashbuckle">Choosing Between NSwag and Swashbuckle</a></li><li><a href="#aioseo-summary">Summary</a></li></ul></div>



<p></p>



<p></p>



<h2 class="wp-block-heading" id="aioseo-what-is-nswag"><strong>What is NSwag</strong></h2>



<p></p>



<figure class="wp-block-image size-full is-resized"><img loading="lazy" decoding="async" width="67" height="67" src="https://www.thecodebuzz.com/wp-content/uploads/2023/07/icon.png" alt="" class="wp-image-27958"/></figure>



<p></p>



<p><strong>NSwag </strong>is a standalone library that allows you to generate Swagger specifications and API client code from existing ASP.NET Core controllers or TypeScript code. </p>



<p></p>



<p>It provides a robust set of features for both API documentation generation and API client generation. Here are some key aspects of NSwag.</p>



<p></p>



<p>NSwag, developers can save time and effort by automatically generating client code and server stubs from existing <strong>APIs </strong>or <strong>OpenAPI </strong>specifications. </p>



<p></p>



<p>This promotes consistency, reduces manual work, and simplifies the process of working with APIs in the .NET ecosystem.</p>



<p></p>



<p><br>Sample Nswag generated API documentation JSON, </p>



<p></p>



<pre class="wp-block-preformatted"> {
  "x-generator": "NSwag v13.4.2.0 (NJsonSchema v10.1.11.0 (Newtonsoft.Json v9.0.0.0))",
  "swagger": "2.0",
  "info": {
    "title": "MyTestService",
    "description": "My First Service",
    "termsOfService": "None",
    "contact": {
      "name": "TheCodeBuzz",
      "url": "thecodebuzz.com",
      "email": "infoatthecodebuzz.com"
    },
    "license": {
      "name": "Trademak ",
      "url": "https://www.thecodebuzz.com"
    },
    "version": "1"
  },
  "host": "localhost:44387",
  "schemes": [
    "https"
  ],
  "produces": [
    "text/plain",
    "application/json",
    "text/json"
  ],
  "paths": {
    "/api/v1/SnowForecast": {
      "get": {
        "tags": [
          "SnowForecast"
        ],
        "operationId": "SnowForecast_Get",
        "responses": {
          "200": {
            "x-nullable": false,
            "description": "",
            "schema": {
              "type": "array",
              "items": {
                "$ref": "#/definitions/WeatherForecast"
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "SnowForecast"
        ],
        "operationId": "SnowForecast_Post",
        "responses": {
          "200": {
            "x-nullable": false,
            "description": "",
            "schema": {
              "type": "array",
              "items": {
                "$ref": "#/definitions/WeatherForecast"
              }
            }
          }
        }
      }
    }
  },
  "definitions": {
    "WeatherForecast": {
      "type": "object",
      "required": [
        "date",
        "temperatureC",
        "temperatureF"
      ],
      "properties": {
        "date": {
          "type": "string",
          "format": "date-time"
        },
        "temperatureC": {
          "type": "integer",
          "format": "int32"
        },
        "temperatureF": {
          "type": "integer",
          "format": "int32"
        },
        "summary": {
          "type": "string"
        }
      }
    }
  }
}</pre>



<p></p>



<h2 class="wp-block-heading" id="aioseo-getting-started">Getting Started &#8211; NSwag Vs Swashbuckle</h2>



<p></p>



<p>Please visit this article to get started,</p>



<p></p>



<ul class="wp-block-list">
<li><a href="https://www.thecodebuzz.com/nswag-swagger-api-documentation-in-net-core/" target="_blank" rel="noopener" title="NSwag Swagger API documentation in ASP.NET Core"><strong>NSwag Swagger API documentation in ASP.NET Core</strong></a></li>
</ul>



<p></p>



<p></p>



<h2 class="wp-block-heading" id="aioseo-main-feature-of-nswag">Main Feature of NSwag</h2>



<p></p>



<h3 class="wp-block-heading" id="aioseo-automate-api-client-side-code-generation">Automate API Client-side Code Generation</h3>



<p></p>



<p>Have you heard of legacy <strong>WSDL </strong>(WebService Schema definition file)? This file was very useful in creating client-side code-based SOAP-WCF-based services in the legacy world. </p>



<p></p>



<p>In Similar lines using  NSwag, you can generate client code in multiple programming languages.</p>



<p>This is particularly useful for client-first development, where you want to quickly create client applications that consume your API</p>



<p></p>



<p><strong>Available code generators:</strong></p>



<p></p>



<ul class="wp-block-list">
<li><a href="https://github.com/RicoSuter/NSwag/wiki/TypeScriptClientGenerator">TypeScriptClientGenerator</a>: Generate TypeScript clients</li>



<li><a href="https://github.com/RicoSuter/NSwag/wiki/CSharpClientGenerator">CSharpClientGenerator</a>: Generate CSharp clients</li>



<li><a href="https://github.com/RicoSuter/NSwag/wiki/CSharpControllerGenerator">CSharpControllerGenerator</a>: Generate CSharp Web API controllers (contract first/schema first development)</li>
</ul>



<p></p>



<h3 class="wp-block-heading" id="aioseo-server-stub-generation">Server Stub Generation </h3>



<p></p>



<p>NSwag can generate server stubs that serve as a starting point for implementing an API&#8217;s server-side logic. These stubs can be used to scaffold the API structure and operations, and developers can then customize the generated code to implement the actual business logic.</p>



<p></p>



<h3 class="wp-block-heading" id="aioseo-reverse-engineering-swagger-specification">Reverse Engineering Swagger Specification </h3>



<p></p>



<p>NSwag can reverse engineer Swagger specifications from existing TypeScript or C# code. </p>



<p></p>



<p>This means you can start with your client-side code and automatically generate the API documentation from it. </p>



<p></p>



<p>This approach can be beneficial in scenarios where you want to ensure that the API specifications match the client-side implementation.</p>



<p></p>



<h3 class="wp-block-heading" id="aioseo-flexibility-and-customization">Flexibility and Customization</h3>



<p></p>



<p>NSwag provides a wide range of configuration options that allow fine-tuning of the generated Swagger specifications and client code. </p>



<p></p>



<p>You can customize various aspects, such as naming conventions, property handling, and serialization settings. This level of flexibility is ideal for projects that require specific code-generation settings</p>



<p></p>



<h3 class="wp-block-heading" id="aioseo-cli-and-visual-studio-integration">CLI and Visual Studio Integration</h3>



<p></p>



<p>NSwag offers command-line tools for automating the code generation process. It can also be integrated with Visual Studio as an extension, allowing developers to generate client code or server stubs directly from within the IDE.</p>



<p></p>



<h3 class="wp-block-heading" id="aioseo-versatile-and-support-more-languages">Versatile and supports more languages</h3>



<p></p>



<p>Below languages supported including,</p>



<p></p>



<ul class="wp-block-list">
<li>TypeScript, </li>



<li>C#, </li>



<li>Java, </li>



<li>and more.</li>
</ul>



<p></p>



<p>NSwag offers advanced features like the ability to generate <strong><em>Angular or TypeScript </em></strong>client code with ng-swagger-gen. </p>



<p>Additionally, it supports integration with ASP.NET Core MVC, Web API, and other frameworks. These features make NSwag a powerful and versatile tool for API client generation.</p>



<p></p>



<h3 class="wp-block-heading" id="aioseo-code-generation-templates">Code Generation Templates</h3>



<p></p>



<p>NSwag provides code generation templates that can be customized to fit your specific project requirements. You have full control over the generated client code, allowing you to tailor it to match your coding standards and practices.</p>



<p></p>



<p></p>



<h2 class="wp-block-heading" id="aioseo-swashbuckle"><strong>What is Swashbuckle</strong></h2>



<p></p>



<figure class="wp-block-image size-full is-resized"><img loading="lazy" decoding="async" width="471" height="432" src="https://www.thecodebuzz.com/wp-content/uploads/2023/07/Nswag-vs-Swashbuckle-diffrences.jpg" alt="" class="wp-image-27959" srcset="https://thecodebuzz.com/wp-content/uploads/2023/07/Nswag-vs-Swashbuckle-diffrences.jpg 471w, https://thecodebuzz.com/wp-content/uploads/2023/07/Nswag-vs-Swashbuckle-diffrences-300x275.jpg 300w" sizes="auto, (max-width: 471px) 100vw, 471px" /></figure>



<p></p>



<p>Swashbuckle is a rich library that integrates Swagger/OpenAPI support directly into ASP.NET Core applications. It provides middleware and configuration options for generating Swagger documentation and UI. </p>



<p></p>



<p>By using Swashbuckle, developers can significantly reduce the manual effort required to create and maintain API documentation. The generated Swagger/OpenAPI documentation provides a clear and comprehensive view of the API, making it easier for other developers to understand, interact with, and consume the API.</p>



<p></p>



<h2 class="wp-block-heading" id="aioseo-getting-started">Getting Started </h2>



<p></p>



<p>Please visit this article to get started,</p>



<p></p>



<ul class="wp-block-list">
<li><a href="https://www.thecodebuzz.com/swagger-api-documentation-in-net-core-3-0/" target="_blank" rel="noopener" title=""><strong>Add Swagger API Documentation in ASP.NET Core</strong></a></li>
</ul>



<p></p>



<p>Sample Swagger jSOn</p>



<p></p>



<pre class="wp-block-preformatted">{
  "openapi": "3.0.1",
  "info": {
    "title": "MyTestService",
    "version": "v1"
  },
  "servers": [
    {
      "url": "https://localhost:5001"
    }
  ],
  "paths": {
    "/WeatherForecast": {
      "post": {
        "tags": [
          "WeatherForecast"
        ],
        "parameters": [
          {
            "name": "city",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-customHeader",
            "in": "header",
            "required": true,
            "schema": {
              "type": "String",
              "default": "test-123456"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success"
          }
        }
      },
      "get": {
        "tags": [
          "WeatherForecast"
        ],
        "summary": "Get weather forcast for a given city name",
        "parameters": [
          {
            "name": "city",
            "in": "query",
            "description": "city name for getting weather forcasting",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "x-customHeader",
            "in": "header",
            "required": true,
            "schema": {
              "type": "String",
              "default": "test-123456"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/WeatherForecast"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/WeatherForecast"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/WeatherForecast"
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "WeatherForecast": {
        "type": "object",
        "properties": {
          "date": {
            "type": "string",
            "format": "date-time"
          },
          "temperatureC": {
            "type": "integer",
            "format": "int32"
          },
          "temperatureF": {
            "type": "integer",
            "format": "int32",
            "readOnly": true
          },
          "summary": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      }
    }
  }
}</pre>



<h2 class="wp-block-heading" id="aioseo-here-are-some-key-aspects-of-swashbuckle">Here are some key aspects of Swashbuckle</h2>



<p></p>



<p></p>



<h3 class="wp-block-heading" id="aioseo-api-documentation-generation">API Documentation Generation</h3>



<p></p>



<p>The primary focus of Swashbuckle is on generating Swagger documentation for your API. It extracts information from your ASP.NET Core controllers, actions, and model classes to create detailed API documentation.</p>



<p></p>



<p></p>



<p><strong>Simplified Setup:</strong> Swashbuckle is known for its ease of setup and use. It requires minimal configuration to get started with generating API documentation. If your main goal is to provide clear and comprehensive API documentation, Swashbuckle can be a straightforward choice.</p>



<p></p>



<h3 class="wp-block-heading" id="aioseo-interactive-swagger-ui">Interactive Swagger UI</h3>



<p></p>



<p>Swashbuckle includes Swagger UI, a user-friendly interface and visually appealing way that allows developers to interact with and explore the API documentation visually. Swagger UI provides a live demonstration of the API endpoints, making it easier for developers to understand how to consume the API.</p>



<p></p>



<h3 class="wp-block-heading" id="aioseo-code-annotations-for-documentation">Code Annotations for Documentation</h3>



<p></p>



<p>Swashbuckle provides attributes that can be used to <strong>enrich </strong>the generated API documentation with additional information, such as <strong>descriptions</strong>, <strong>examples</strong>, or <strong>parameter </strong>constraints.</p>



<p></p>



<h3 class="wp-block-heading" id="aioseo-customization-options">Customization Options</h3>



<p></p>



<p>Swashbuckle offers various <a href="https://www.thecodebuzz.com/customizing-swagger-documentation-in-dotnet-core-2-1/">customization options to tailor the API documentation</a> to specific needs. Developers can control the visibility of certain endpoints, customize UI appearance, and include additional metadata in the Swagger specification.</p>



<p></p>



<h3 class="wp-block-heading" id="aioseo-integration-with-asp-net-core">Integration with ASP.NET Core</h3>



<p></p>



<p>Swashbuckle seamlessly integrates with ASP.NET Core middleware, making it easy to generate Swagger documentation as part of your application&#8217;s startup process. Swashbuckle is a mature library that has been widely adopted in the ASP.NET Core community. It has been continuously updated and maintained, making it a reliable choice for many projects.</p>



<p></p>



<h2 class="wp-block-heading" id="aioseo-choosing-between-nswag-and-swashbuckle"><strong>Choosing Between NSwag and Swashbuckle</strong></h2>



<p></p>



<p>To decide which library is best for your ASP.NET Core project, consider the following use cases,</p>



<p></p>



<ul class="wp-block-list">
<li><strong>Use case</strong> 1 &#8211; <strong>API Client or Server side Code Generation:</strong> If you need to generate API client code for various programming languages, NSwag is the best option. Its API client generation capabilities can significantly simplify the process of creating client applications that consume your API.</li>
</ul>



<p></p>



<p>NSwag can be used to automatically generate strongly typed C# or TypeScript client code for your API. </p>



<p></p>



<ul class="wp-block-list">
<li><strong>Client-first development:</strong> If your project follows a client-first development approach and you want to reverse engineer Swagger specifications from existing TypeScript or C# code, NSwag provides this functionality.</li>
</ul>



<p></p>



<ul class="wp-block-list">
<li><strong>Code Generation from Existing APIs</strong>: If you have an existing API implemented in a different technology or with manual code, you can use NSwag to generate C# client code or TypeScript Fetch clients for that API. This allows you to create. NET-based clients for external APIs quickly and seamlessly, enabling integration with those APIs in your .NET applications.</li>
</ul>



<p></p>



<ul class="wp-block-list">
<li><strong>Advanced Customization:</strong> If you require advanced customization options and fine-tuning of the generated Swagger specifications and client code, NSwag is the more flexible choice.</li>
</ul>



<p></p>



<ul class="wp-block-list">
<li><strong>API Documentation:</strong> If your main focus is on generating clear and comprehensive API documentation with minimal configuration, <strong>Swashbuckle&#8217;s </strong>simplicity may be preferable.</li>
</ul>



<p></p>



<ul class="wp-block-list">
<li><strong>Interactive Swagger UI:</strong> If you want to provide a visually appealing and interactive way for developers to explore your API documentation, Swashbuckle&#8217;s inclusion of Swagger UI is a valuable feature.</li>
</ul>



<p></p>



<ul class="wp-block-list">
<li><strong>Community and Support:</strong> Both NSwag and Swashbuckle have active communities and are well-supported. Consider checking their documentation, GitHub repositories, and forums to gauge the level of community engagement and support.</li>
</ul>



<p></p>



<h2 class="wp-block-heading" id="aioseo-summary">Summary</h2>



<p></p>



<p>Both <strong><em>NSwag and Swashbuckle</em></strong> are outstanding libraries with distinct strengths. </p>



<p></p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>If your project emphasizes API client generation, advanced customization, or reverse engineering from existing code, NSwag will be a the better choice. </p>



<p></p>
</blockquote>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>On the other hand, if you primarily need basic API documentation with the added benefit of Swagger UI, Swashbuckle will be the better choice.. </p>
</blockquote>



<p></p>



<p>Evaluate your project requirements, the features offered by each library, and your team&#8217;s preferences to make the best decision for your ASP.NET Core application.</p>



<p></p>



<hr>



<p class=""></p>



<p class="has-background" style="background-color:#b6d9ac;font-size:18px"><br>Please <strong><em>bookmark </em></strong>this page and <em><strong>share </strong></em>it with your friends.                                                    Please <a href="https://www.thecodebuzz.com/subscription/" target="_blank" rel="noreferrer noopener"><em><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-luminous-vivid-orange-color"><strong>Subscribe</strong> </mark></em></a>to the blog to receive notifications on freshly published (2025) best practices and guidelines for software design and development.</p>




<br>



<hr>



<p class=""></p>



<p></p>



<p></p>



<p></p><p>The post <a href="https://thecodebuzz.com/nswag-vs-swashbuckle-swagger-differences-openapi-rest-guidelines/">NSwag Vs Swashbuckle – What Is The Difference</a> first appeared on <a href="https://thecodebuzz.com">TheCodeBuzz</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://thecodebuzz.com/nswag-vs-swashbuckle-swagger-differences-openapi-rest-guidelines/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
