createServerProtocolHandler(
args: {environment:LspEnvironment; }):Promise<LixServerProtocolHandler>
The handler for the lix server protocol.
Usage with a server framework.
// any server framework goes
// here, like express, polka, etc.
// frameworks that do not use
// web standard Request and Response
// objects will need to be mapped.
const app = new Hono();
const lspHandler = createServerProtocolHandler({ storage });
app.use('/lsp/*', async (req) => {
await lspHandler(req);
});Testing the handler.
const lspHandler = createServerProtocolHandler({ storage });
const request = new Request('/lsp/new', {
method: 'POST',
body: new Blob(['...']),
});
const response = await lspHandler(request);
expect(response).to(...);| Parameter | Type |
|---|---|
args | { environment: LspEnvironment; } |
args.environment | LspEnvironment |
Promise<LixServerProtocolHandler>