Function: createServerProtocolHandler()

createServerProtocolHandler(args): Promise<LixServerProtocolHandler>

The handler for the lix server protocol.

Parameters

args

environment

LspEnvironment

Returns

Promise<LixServerProtocolHandler>

Examples

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(...);