Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/exotjs/bun
Bun integration for Exot Inspector
https://github.com/exotjs/bun
bun inspector
Last synced: about 2 months ago
JSON representation
Bun integration for Exot Inspector
- Host: GitHub
- URL: https://github.com/exotjs/bun
- Owner: exotjs
- License: mit
- Created: 2024-02-26T16:24:56.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-02-26T17:44:34.000Z (11 months ago)
- Last Synced: 2024-05-04T00:16:26.423Z (8 months ago)
- Topics: bun, inspector
- Language: TypeScript
- Homepage: https://exot.dev
- Size: 59.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.txt
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# 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
```sh
bun add @exotjs/inspector @exotjs/bun
```## Usage
```ts
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`
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](https://github.com/exotjs/inspector/blob/main/CONTRIBUTING.md) and please follow our [Code of Conduct](https://github.com/exotjs/inspector/blob/main/CODE_OF_CONDUCT.md).
## License
MIT