0.20.0 • Published 12 months ago
@rest-vir/implement-service v0.20.0
@rest-vir/implement-service
Part of the rest-vir suite. This package is used for implementing a REST service already defined by @rest-vir/define-service.
See the full docs at https://electrovir.github.io/rest-vir
Installation
npm i @rest-vir/implement-serviceUsage
Implement your service:
import {HttpStatus, implementService} from '@rest-vir/implement-service';
export const myServiceImplementation = implementService(
{
service: myServiceDefinition,
},
{
endpoints: {
'/my-endpoint'() {
return {
statusCode: HttpStatus.Ok,
};
},
async '/my-endpoint/:user-id'({pathParams}) {
const user = await readUserFromDatabase(pathParams['user-id']);
return {
statusCode: HttpStatus.Ok,
responseData: user,
};
},
},
webSockets: {
'/my-web-socket': {
message({webSocket}) {
webSocket.send('hi!');
},
},
},
},
);0.20.0
12 months ago
0.19.2
12 months ago
0.19.1
12 months ago
0.19.0
1 year ago
0.18.1
1 year ago
0.18.0
1 year ago
0.17.2
1 year ago
0.17.1
1 year ago
0.17.0
1 year ago
0.16.0
1 year ago
0.15.1
1 year ago
0.15.0
1 year ago
0.14.0
1 year ago
0.13.0
1 year ago
0.12.0
1 year ago
0.11.4
1 year ago
0.11.3
1 year ago
0.11.2
1 year ago
0.11.1
1 year ago
0.11.0
1 year ago
0.10.0
1 year ago
0.9.1
1 year ago
0.9.0
1 year ago
0.8.3
1 year ago
0.8.2
1 year ago
0.8.1
1 year ago
0.8.0
1 year ago
0.7.0
1 year ago
0.6.0
1 year ago
0.5.4
1 year ago
0.5.3
1 year ago
0.5.2
1 year ago
0.5.1
1 year ago
0.5.0
1 year ago
0.4.1
1 year ago
0.4.0
1 year ago
0.3.4
1 year ago
0.3.3
1 year ago
0.3.2
1 year ago
0.3.1
1 year ago
0.3.0
1 year ago
0.2.0
1 year ago
0.1.0
1 year ago
0.0.7
1 year ago
0.0.6
1 year ago
0.0.5
1 year ago
0.0.4
1 year ago
0.0.3
1 year ago
0.0.2
1 year ago