@yodaos-pkg/ink-vfs-server
v0.1.0
Published
HTTP VFS server for Ink bundles with standalone and framework adapters
Readme
@yodaos-pkg/ink-vfs-server
@yodaos-pkg/ink-vfs-server exposes Ink app files through a small HTTP VFS
protocol that works with @yodaos-pkg/ink.
It supports three integration styles:
- standalone Node HTTP server
- Express or Connect style middleware
- Fastify route plugin
Build
npm run buildTest
npm testProtocol
GET /ink-vfs/apps/:appId/manifestGET /ink-vfs/apps/:appId/files/:path
The manifest returns a JSON payload with appId and files, where each file
entry includes at least path and may also include size, contentType, and
etag.
Standalone Server
import { startVfsServer } from '@yodaos-pkg/ink-vfs-server';
await startVfsServer(
{
appId: 'demo',
rootDir: './app',
},
{
port: 8081,
host: '0.0.0.0',
},
);Express Middleware
import express from 'express';
import { createExpressMiddleware } from '@yodaos-pkg/ink-vfs-server';
const app = express();
app.use('/api', authMiddleware);
app.use(
createExpressMiddleware({
appId: 'demo',
rootDir: './app',
basePath: '/ink-vfs',
}),
);Fastify Plugin
import Fastify from 'fastify';
import { createFastifyPlugin } from '@yodaos-pkg/ink-vfs-server';
const fastify = Fastify();
await fastify.register(
createFastifyPlugin({
appId: 'demo',
rootDir: './app',
basePath: '/ink-vfs',
}),
);