0.0.2 • Published 2 years ago
servicerjs v0.0.2
Servicer.js
Installation
yarn add servicerjs
Server Example
import Service from "servicerjs";
const TestService = new Service(2000, "localhost");
TestService.addAction("createUser", async (data) => {
return {
status: "success",
firstName: data.firstName,
lastName: data.lastName,
id: "1231231232131",
};
});
TestService.start((port, host) => {
console.log(`Server is running on http://${host}:${port}`);
});
`
Client Example
import Service from "servicerjs";
const TestService = new Service(2000, "localhost");
TestService.callAction(
"createUser",
{ firstName: "Elon", lastName: "Musk" },
function (responseData) {
console.log(responseData);
}
);
`