0.1.0 • Published 1 year ago

@exotjs/bun v0.1.0

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

Bun integration for Exot Inspector

This repository contains the WebSocket server implementation for Bun, enabling direct connection of the Exot Inspector App to your server.

Install

bun add @exotjs/inspector @exotjs/bun

Usage

import { Inspector } from '@exotjs/inspector';
import { MemoryStore } from '@exotjs/inspector/store';
import { websocket } from '@exotjs/bun';

const inspector = new Inspector({
  store: new MemoryStore(),
});

Bun.serve({
  ...websocket({
    inspector,
  }),
  port: 3003,
});

Configuration

The websocket() function accepts the following configuration parameters:

authorize: (req, server) => Promise<string> | string

Configure the authorize function to inspect the incoming request and authorize the user. It should return the user's name from the function or throw an error if unauthorized.

inspector: Inspector (required)

Provide an instance of Inspector.

path: string

Configure the path for the WebSocket server (default is /_inspector).

Contributing

See Contributing Guide and please follow our Code of Conduct.

License

MIT

0.1.0

1 year ago