0.5.2 • Published 5 months ago

@delight-rpc/next.js v0.5.2

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

@delight-rpc/next.js

Install

npm install --save @delight-rpc/next.js
# or
yarn add @delight-rpc/next.js

Usage

// api.d.ts
interface IAPI {
  echo(message: string): string
}

// src/pages/api/rpc.ts
import { createServer } from '@delight-rpc/next.js'

const api: IAPI = {
  echo(message: string): string {
    return message
  }
}

export default createServer(api, {})

API

createServer

function createServer<IAPI>(
  api: DelightRPC.ImplementationOf<IAPI>
, options?: {
    basicAuth?: (username: string, password: string) => PromiseLike<boolean> | boolean
    parameterValidators?: DelightRPC.ParameterValidators<IAPI>
    version?: `${number}.${number}.${number}`
    ownPropsOnly?: boolean
    channel?: string | RegExp | AnyChannel
  }
): (req: NextApiRequest, res: NextApiResponse) => Promise<void>
0.5.2

5 months ago

0.5.1

11 months ago

0.5.0

1 year ago

0.4.1

1 year ago

0.4.0

2 years ago

0.3.2

2 years ago

0.3.3

2 years ago

0.3.0

2 years ago

0.3.1

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago