1.2.2 • Published 4 years ago
@theta-rpc/core v1.2.2
Installation
with npm:
npm install --save @theta-rpc/{core,common,errors,http-transport}
with yarn:
yarn add @theta-rpc/{core,common,errors,http-transport}
Simple usage
import { ThetaRPCFactory } from '@theta-rpc/core';
import { Procedure, Method } from '@theta-rpc/common';
import { HttpTransport, IHttpTransportOptions } from '@theta-rpc/http-transport';
@Procedure('machine')
class MachineMethods {
@Method('sayHello')
public sayHello() {
return 'Hello!';
}
}
ThetaRPCFactory.create<IHttpTransportOptions>({
server: {
transport: HttpTransport,
transportOptions: {
port: 8080,
endpoint: '/json-rpc'
}
},
procedures: [MachineMethods]
});
You can see other samples in the samples repository
Dependencies
Package | Status |
---|---|
@theta-rpc/core | |
@theta-rpc/common | |
@theta-rpc/errors | |
@theta-rpc/http-transport | |
@theta-rpc/ws-transport |