1.2.1-beta.0 • Published 4 years ago
@prxima/services-manager v1.2.1-beta.0
Prxima Service Control Manager
Próxima Service Manager, run all-in-one. Simple and silent
Summary
- Introduction
- Getting Start
- Recommendations
- Specifications\
4.1. Add Service,
options
\ 4.2. Status - Features
Introduction
Robust projects today require a variety of micro-services, customer services, and other resources running on our machines before we can proceed with development.
With that in mind the next team develops this little service manager. Easy to use, simple to set up.
Getting Start
Install this package
npm i -D @prxima/services-manager
create file serve-manager.js
on root npm project
const { ServicesManager } = required("@prxima/services-manager");
new ServicesManager()
.addService(
"Client Service" /* service display name */,
"npm run client" /* shell command to run*/,
(data, info) => {
return data.indexOf("success") > -1 ? 1 : 0;
} /* callback to read out command and return status, 0 = offline and 1 = online */
)
.addService("Server Service", "npm run server", data =>
data.indexOf("listening") > -1 ? 1 : 0
);
add script into package.json
{
...
scripts:[
...
"start": "node ./serve-manager.js",
...
],
...
}
now, time to code! 🎧💻📦
npm run start
Specifications
// TODO:
addService, options
Status
Status code is used to inform the manager at what stage of execution of the command the service is in; Status is obtained by service callback or message combination in options
-2; // Error and require re-boot command
-1; // Error and await
0; // service offline and await
1; // service online and active
Features and North
- Run shell commands in parallel; v1.0.x \
- Associate callBack to status service; v1.1.x \
- Colored notification whit all services status; v1.0.x\
- Auto status math by partial message definition; v1.1.x\
- Reload command whit specified error; v1.2.x\
- API Service;\
- Query Services info;\
- Query Status services;\
- Web GUI Client;\
Powered with ❤👌