8.0.1 • Published 11 months ago

@delight-rpc/http-server v8.0.1

Weekly downloads
84
License
MIT
Repository
github
Last release
11 months ago

@delight-rpc/http-server

The HTTP server implementation of delight-rpc, it needs to be used with the client library @delight-rpc/http-client.

Install

npm install --save @delight-rpc/http-server
# or
yarn add @delight-rpc/http-server

Usage

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

// server.ts
const api: IAPI = {
  echo(message) {
    return message
  }
}

const server = createServer(api, {
  loggerLevel: Level.None
, healthCheckEndpoint: true
})

server.listen(8080, address => console.log(address))

API

enum Level {
  Trace
, Debug
, Info
, Warn
, Error
, Fatal
, None
}

createServer

function createServer<IAPI extends object>(
  api: DelightRPC.ImplementationOf<IAPI>
, options?: {
    loggerLevel?: Level = Level.None
    cors?: boolean = false
    healthCheckEndpoint?: boolean = false
    parameterValidators?: DelightRPC.ParameterValidators<IAPI>
    version?: `${number}.${number}.${number}`
    ownPropsOnly?: boolean
    channel?: string | RegExp | AnyChannel
  }
): FastifyInstance
8.0.1

11 months ago

8.0.0

1 year ago

7.0.0

1 year ago

6.1.0

2 years ago

6.1.2

2 years ago

6.1.1

2 years ago

6.0.1

2 years ago

6.0.0

2 years ago

5.1.3

2 years ago

5.1.2

2 years ago

5.1.1

2 years ago

5.1.0

2 years ago

5.0.2

2 years ago

5.0.1

2 years ago

5.0.0

2 years ago

2.1.0

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

3.2.0

2 years ago

3.1.0

2 years ago

3.0.1

2 years ago

3.0.0

2 years ago

4.0.1

2 years ago

4.0.0

2 years ago

1.0.0

2 years ago

0.1.13

2 years ago

0.1.14

2 years ago

0.1.10

3 years ago

0.1.11

3 years ago

0.1.12

3 years ago

0.1.9

3 years ago

0.1.8

3 years ago

0.1.7

3 years ago

0.1.6

3 years ago

0.1.5

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