# @yupio/atproto-xrpc-server

> ## Usage

Latest version **0.2.1** (published 2023-06-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install @yupio/atproto-xrpc-server
pnpm add @yupio/atproto-xrpc-server
yarn add @yupio/atproto-xrpc-server
bun add @yupio/atproto-xrpc-server
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: no vulnerabilities; high maintenance score.

Warnings: low downloads; no types; no esm support; large bundle; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.2.1 |
| Published | 2023-06-06 |
| First published | 2023-06-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 10 |
| Unpacked size | 11.3 MB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 9737 |
| Maintainers | yupalan, vernonjohnson23 |

## Links

- npm: https://www.npmjs.com/package/@yupio/atproto-xrpc-server
- Repository: https://github.com/bluesky-social/atproto
- Homepage: https://github.com/bluesky-social/atproto#readme
- Issues: https://github.com/bluesky-social/atproto/issues
- npm.io page: https://npm.io/package/@yupio/atproto-xrpc-server

## Dependencies (10)

- [ws](https://npm.io/package/ws.md) ^8.12.0
- [zod](https://npm.io/package/zod.md) ^3.21.4
- [cbor-x](https://npm.io/package/cbor-x.md) ^1.5.1
- [express](https://npm.io/package/express.md) ^4.17.2
- [mime-types](https://npm.io/package/mime-types.md) ^2.1.35
- [http-errors](https://npm.io/package/http-errors.md) ^2.0.0
- [uint8arrays](https://npm.io/package/uint8arrays.md) 3.0.0
- [@yupio/atproto-common](https://npm.io/package/@yupio/atproto-common.md) ^0.2.1
- [@yupio/atproto-crypto](https://npm.io/package/@yupio/atproto-crypto.md) ^0.1.2
- [@yupio/atproto-lexicon](https://npm.io/package/@yupio/atproto-lexicon.md) ^0.1.1

## Recent versions

- 0.2.1 (latest) — 2023-06-06

## README

# XRPC Server API

## Usage

```typescript
import * as xrpc from '@atproto/xrpc-server'
import express from 'express'

// create xrpc server
const server = xrpc.createServer([{
    lexicon: 1,
    id: 'io.example.ping',
    defs: {
      main: {
        type: 'query',
        parameters: {
          type: 'params',
          properties: { message: { type: 'string' } },
        },
        output: {
          encoding: 'application/json',
        },
      },
    },
  }
])

function ping(ctx: {auth: xrpc.HandlerAuth | undefined, params: xrpc.Params, input: xrpc.HandlerInput | undefined, req: express.Request, res: express.Response}) {
  return { encoding: 'application/json', body: {message: ctx.params.message }}
}

server.method('io.example.ping', ping)

// mount in express
const app = express()
app.use(server.router)
app.listen(8080)
```

## License

MIT

---
_Source: https://npm.io/package/@yupio/atproto-xrpc-server · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
