0.5.2 • Published 2 years ago

@delight-rpc/next.js v0.5.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years 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

2 years ago

0.5.1

2 years ago

0.5.0

2 years ago

0.4.1

3 years ago

0.4.0

3 years ago

0.3.2

3 years ago

0.3.3

3 years ago

0.3.0

3 years ago

0.3.1

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago