Important: This is a quick proof of concept and how this works is subject to change until custom handlers reaches general availability.
This is an ASP.NET Core app built with dotnet new react
. There were 3 main changes:
Program.cs
FUNCTIONS_HTTPWORKER_PORT
.server
as the app will run from a subfolder within a function app. This is configured using an app setting named ServerSubfolder
.Startup.cs
__path__
query string.Publish the app into a folder named server
in the function app.
cd dotnet-react
dotnet publish -c Release -o ../function-app/server
This is the main function app. host.json
has been configured to start dotnet server/dotnet-react.dll
as the custom hander.
A proxy is configured in proxies.json
to forward all requests to /api/index?__path__={path}
in the function app. This is currently needed as the original path required for routing in ASP.NET Core is lost when the custom handler is invoked.
There's an index
function that invokes the custom handler.
func start
Create a function app in the Windows consumption plan, then publish with this command:
func azure functionapp publish $FUNCTION_APP_NAME --no-build -b local --force