express-flyweb
v0.1.0
Published
FlyWeb middleware for Express and Hono — serve structured data to AI agents.
Maintainers
Readme
express-flyweb
FlyWeb middleware for Express, Hono, Fastify, and any Node.js HTTP server — serve structured data to AI agents.
Install
npm install express-flywebUsage
import express from 'express';
import { flyweb, createResourceHandler } from 'express-flyweb';
const app = express();
// Serve flyweb.json at /.well-known/flyweb.json
app.use(flyweb({
flyweb: '1.0',
entity: 'My API',
type: 'api',
attribution: { required: true, license: 'MIT', must_link: true },
resources: {
items: {
path: '/.flyweb/items',
format: 'json',
fields: ['id', 'name', 'description'],
access: 'free',
},
},
}));
// Serve resource data
app.get('/.flyweb/items', createResourceHandler({
format: 'json',
source: () => getItems(),
queryable: ['category'],
}));
app.listen(3000);Works With
- Express 4/5
- Connect
- Any Node.js HTTP server (http.createServer)
- Fastify (with middie plugin)
Links
License
MIT
