Framework Adapters
Express / Node.js
Express and Node.js HTTP adapter
Express / Node.js#
The built-in middleware() method returns a standard Node.js HTTP handler compatible with Express, Connect, and raw http.createServer.
typescript
import { createSurf } from '@surfjs/core'import express from 'express'ย const surf = await createSurf({ name: 'Express App', commands: { /* ... */ },})ย const app = express()app.use(express.json())app.use(surf.middleware()) // Mounts all Surf routesย // Routes mounted:// GET /.well-known/surf.json โ manifest with ETag/304// POST /surf/execute โ command execution// POST /surf/pipeline โ pipeline execution// POST /surf/session/start โ start session// POST /surf/session/end โ end sessionย app.listen(3000)