# redsvr

> Redis compatible server framework for Node

Latest version **1.0.2** (published 2020-02-20) · ISC license · 0 weekly downloads

## Install

```sh
npm install redsvr
pnpm add redsvr
yarn add redsvr
bun add redsvr
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2020-02-20 |
| First published | 2020-02-20 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 9.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | ixqbar@gmail.com |
| Maintainers | ixqbar |
| Keywords | redis, server |

## Links

- npm: https://www.npmjs.com/package/redsvr
- Repository: https://github.com/jonnywang/redsvr
- Issues: https://github.com/jonnywang/redsvr/issues
- npm.io page: https://npm.io/package/redsvr

## Alternatives

- [memory-cache](https://npm.io/package/memory-cache.md) — 795.0K weekly downloads
- [@httptoolkit/proxy-agent](https://npm.io/package/@httptoolkit/proxy-agent.md) — 11.2K weekly downloads
- [express-cache-controller](https://npm.io/package/express-cache-controller.md) — 5.3K weekly downloads
- [http-cache-middleware](https://npm.io/package/http-cache-middleware.md) — 4.5K weekly downloads
- [cache2](https://npm.io/package/cache2.md) — 1.5K weekly downloads

## Recent versions

- 1.0.2 (latest) — 2020-02-20
- 1.0.1 — 2020-02-20
- 1.0.0 — 2020-02-20

## README

### install
```
npm install -D redsvr
```

### usage
```node
const redisServer = require('redsvr')

redisServer(3000, (socket,command,args) => {
    switch (command.toLowerCase()) {
        case 'command':
            //状态回复 +(state)\r\n
            socket.writeOK()
            break;
        case 'bool':
            socket.writeBoolean(true)
            break;
        case 'get':
            //批量回复 $(contentLength)\r\n(content)\r\n
            //多条时增加 *(contentRows)\r\n$(contentLength)\r\n(content)\r\n
            socket.writeBulk('hello')
            break;
        case 'hgetall':
        case 'lrange':
            //socket.writeRaw('*2\r\n$3\r\nfoo\r\n$3\r\nbar\r\n')
            socket.writeMultiBulk(['foo', '', null])
            break;
        case 'err':
        case 'error':
            //错误回复 -(error)\r\n
            socket.writeError('error!!!')
            break;
        case 'number':
            //整数回复 :(number)\r\n
            socket.writeNumber(123)
            break;
        default:
            socket.writeError('unknown command')
            break;
    }
})
```

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