@stone-js/azure-functions-http-adapter
v0.8.15
Published
Azure Functions v4 HTTP adapter for Stone.js. Run your app on Azure Functions HTTP triggers (Web-standard HttpRequest → HttpResponseInit) using the Continuum Architecture.
Maintainers
Readme
Stone.js - Azure Functions HTTP Adapter
The Azure Functions HTTP Adapter lets your Stone.js application run on Azure Functions v4 HTTP triggers, unchanged. Azure Functions v4 uses a Web-standard model (HttpRequest → HttpResponseInit), so the adapter reuses the same request normalization as the Fetch adapter and only differs in the response it hands back to the Functions host.
Introduction
In Stone.js, adapters are the translation layer between a platform and your domain. Azure Functions v4 invokes an HTTP-triggered function with a Web-standard HttpRequest (built on undici) and expects an HttpResponseInit in return. This adapter turns the request into a standardized IncomingHttpEvent, runs it through your kernel, and builds the HttpResponseInit the host writes to the wire, so your routes, validation and cookies run on Azure Functions with no changes to the domain.
It does not own a server: run() returns the handler you register with app.http(...).
Installation
npm install @stone-js/azure-functions-http-adapter
# or
pnpm add @stone-js/azure-functions-http-adapter
# or
yarn add @stone-js/azure-functions-http-adapterRequires
@stone-js/core,@stone-js/http-coreand@stone-js/filesystemas peer dependencies.
Usage
Declarative (decorator):
import { StoneApp } from '@stone-js/core'
import { Routing } from '@stone-js/router'
import { AzureFunctionsHttp } from '@stone-js/azure-functions-http-adapter'
@AzureFunctionsHttp()
@Routing()
@StoneApp({ name: 'tasks' })
export class Application {}Imperative (blueprint):
import { defineStoneApp } from '@stone-js/core'
import { routerBlueprint } from '@stone-js/router'
import { azureFunctionsHttpAdapterBlueprint } from '@stone-js/azure-functions-http-adapter'
export const App = defineStoneApp(
{ name: 'tasks' },
[routerBlueprint, azureFunctionsHttpAdapterBlueprint]
)run() returns the handler you register with @azure/functions:
import { app } from '@azure/functions'
app.http('stone', {
methods: ['GET', 'POST', 'PUT', 'PATCH', 'DELETE'],
authLevel: 'anonymous',
route: '{*path}',
handler: await stoneApp.run()
})Documentation
See the official documentation for the full guide.
