<?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/"
	
	xmlns:georss="http://www.georss.org/georss"
	xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
	>

<channel>
	<title>Cloud Archives - Ryan Peden</title>
	<atom:link href="https://ryanpeden.com/category/cloud/feed/" rel="self" type="application/rss+xml" />
	<link>https://ryanpeden.com/category/cloud/</link>
	<description>Full Stack DevRel</description>
	<lastBuildDate>Sun, 18 Aug 2019 12:38:21 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.3.2</generator>
<site xmlns="com-wordpress:feed-additions:1">155423463</site>	<item>
		<title>How to remove /api from Azure Functions URLs</title>
		<link>https://ryanpeden.com/how-to-remove-api-from-azure-functions-urls/</link>
					<comments>https://ryanpeden.com/how-to-remove-api-from-azure-functions-urls/#comments</comments>
		
		<dc:creator><![CDATA[Ryan Peden]]></dc:creator>
		<pubDate>Thu, 15 Aug 2019 18:11:27 +0000</pubDate>
				<category><![CDATA[Cloud]]></category>
		<category><![CDATA[CodeProject]]></category>
		<guid isPermaLink="false">https://ryanpeden.com/?p=107</guid>

					<description><![CDATA[<p>Note: All of the following assumes you&#8217;re working with Azure Functions 2.0. Azure Functions are great. By default, all HTTP functions on Azure have their URLs prefixed with /api. For example, if you have functions named Function1 and Function2, you&#8217;d reach them by calling http://my-app.azurewebsites.net/api/Function1 and http://my-app.azurewebsites.net/api/Function2. Usually, this is</p>
<div class="belowpost"><a class="btnmore icon-arrow" href="https://ryanpeden.com/how-to-remove-api-from-azure-functions-urls/"><span>Read More</span></a></div>
<p>The post <a rel="nofollow" href="https://ryanpeden.com/how-to-remove-api-from-azure-functions-urls/">How to remove /api from Azure Functions URLs</a> appeared first on <a rel="nofollow" href="https://ryanpeden.com">Ryan Peden</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p><em>Note: All of the following assumes you&#8217;re working with Azure Functions 2.0.</em></p>



<p>Azure Functions are great. By default, all HTTP functions on Azure have their URLs prefixed with <code>/api</code>. For example, if you have functions named Function1 and Function2, you&#8217;d reach them by calling <code>http://my-app.azurewebsites.net/api/Function1</code> and  <code>http://my-app.azurewebsites.net/api/Function2</code>.</p>



<p>Usually, this is fine. But it seems like an arbitrary restriction. What if you&#8217;d rather not have it?</p>



<p>Fortunately, there&#8217;s a configuration option in your function app&#8217;s <code>host.json</code> file to change it. Unfortunately, as I&#8217;m writing this, <a href="https://docs.microsoft.com/en-us/azure/azure-functions/functions-host-json">Microsoft&#8217;s documentation</a> is incorrect. </p>



<p>It tells you your <code>host.json</code> should look something like this if you want to remove the /api prefix:</p>



<pre class="wp-block-preformatted">{
    "http": {
        "routePrefix": ""
    }
}</pre>



<p>This won&#8217;t work. If you&#8217;re running Visual Studio, it&#8217;ll tell you <em>Property name is not allowed by the schema.</em> Instead, the <code>http</code> object must be placed inside of <code>extensions</code>:</p>



<pre class="wp-block-preformatted">{
  "version": "2.0",
  "extensions": {
    "http": {
      "routePrefix": ""
    }
  }
}</pre>



<p>Setting <code>routePrefix</code> to an empty string removes <code>/api</code> from the URL. Now, to access Function1, you&#8217;d call  <code>http://my-app.azurewebsites.net/Function1</code>.</p>



<p>Also note the <code>version</code> property. If you don&#8217;t add this, the Azure Functions local simulator will flip out and fall into an infinite loop of scary-looking error messages:</p>



<figure class="wp-block-image"><img decoding="async" fetchpriority="high" width="1000" height="526" data-attachment-id="108" data-permalink="https://ryanpeden.com/how-to-remove-api-from-azure-functions-urls/image/" data-orig-file="https://i0.wp.com/ryanpeden.com/wp-content/uploads/2019/08/image.png?fit=1228%2C646&amp;ssl=1" data-orig-size="1228,646" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="image" data-image-description="" data-image-caption="" data-medium-file="https://i0.wp.com/ryanpeden.com/wp-content/uploads/2019/08/image.png?fit=300%2C158&amp;ssl=1" data-large-file="https://i0.wp.com/ryanpeden.com/wp-content/uploads/2019/08/image.png?fit=1000%2C526&amp;ssl=1" src="https://i0.wp.com/ryanpeden.com/wp-content/uploads/2019/08/image.png?resize=1000%2C526&#038;ssl=1" alt="" class="wp-image-108" data-recalc-dims="1"/></figure>



<p>If host.json is blank, the simulator will be fine. But as soon as you add <em>anything else</em> to host.json, you also have to add a version, or the simulator will go crazy.</p>



<p>And that&#8217;s it! You now know how to remove /api from your Azure Functions URLs. You can also use a non-blank string to use a prefix other than <em>api. </em>If you&#8217;d like your functions URLs prefixed by <em>popcorn </em>or <em>cats</em>, there&#8217;s nothing stopping you!</p>
<p>The post <a rel="nofollow" href="https://ryanpeden.com/how-to-remove-api-from-azure-functions-urls/">How to remove /api from Azure Functions URLs</a> appeared first on <a rel="nofollow" href="https://ryanpeden.com">Ryan Peden</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://ryanpeden.com/how-to-remove-api-from-azure-functions-urls/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">107</post-id>	</item>
	</channel>
</rss>
