open-index/open-npm huggingface dataset:
npm package: @saber2pr/messager
Description: 文本传输
Author: saber2pr
Latest version: 0.0.18

# Messager

文本传输

```sh
docker pull saber2pr/messager:tag
docker run -d -p 3000:3000 -it saber2pr/messager:tag
```

# dev

```bash
yarn
yarn build
yarn start
```

# H5 启动 Debug 模式

> 右下角启用虚拟控制台

```bash
<前端页面 url>?debug
```
npm package: @saber2pr/next-with-axios
Description: axios plugin for nextjs.
Author: saber2pr
Latest version: 0.0.6

# @saber2pr/next-with-axios

> axios plugin for nextjs.

```bash
yarn add @saber2pr/next-with-axios
```

```ts
import createAxiosMonad, { fmap } from '@saber2pr/next-with-axios'

const AxiosMonad = createAxiosMonad(async (handler, ctx) => {
  const result: GetServerSidePropsResult<any> = {
    props: {},
  }
  try {
    result.props = await handler(axios, ctx)
  } catch (error) {
    result.props = error
  } finally {
    return result
  }
})

const withRedirect = fmap((withAxios) => (handler, ctx) => {
  const url = ctx.req.url
  if (url === '/index') {
    ctx.res.writeHead(302, {
      Location: '/',
    })
    ctx.res.end()
  }
  return withAxios(handler)(ctx)
})(AxiosMonad)
```

> Author: saber2pr