Using application setting "AzureWebJobsDisableHomepage": true the default home page for an Azure Function App is disabled, but how can I replace this page with something else?
For example, having a function that returns an HTML page:
import { AzureFunction, Context, HttpRequest } from "@azure/functions"
import { promises as fs } from "fs"
import { resolve } from "path"
const httpTrigger: AzureFunction = async function (context: Context, req: HttpRequest): Promise<void> {
const htmlPage = await fs.readFile(resolve(__dirname, "../../index.html"), "utf-8")
context.res = {
headers: {
"content-type": "text/html"
},
body: htmlPage
}
};
export default httpTrigger;
Setting "routePrefix": "" in host.json I should be able to serve this function from any route:
"extensions": {
"http": {
"routePrefix": ""
}
}
But I just can't serve it from /, it always returns an empty page. Is there any way to overwrite this behavior?



