To use Serverless Express with Azure Functions, implement an index.js and a function.json. Note that the out-binding parameter must be named "$return" for the package to work correctly.
// index.js
const serverlessExpress = require('@codegenie/serverless-express')
const app = require('./app')
const cachedServerlessExpress = serverlessExpress({ app })
module.exports = async function (context, req) {
return cachedServerlessExpress(context, req)
}
// function.json
{
"bindings": [
{
"authLevel": "anonymous",
"type": "httpTrigger",
"direction": "in",
"name": "req",
"route": "{*segments}"
},
{
"type": "http",
"direction": "out",
"name": "$return"
}
]
}