PID management. Light, fast and secure. Writed with native Typescript code and no dependencies are used.
- npm run pack
- Copy the file "package_name-x.x.x.tgz" in the project root folder.
- In the "package.json" file insert: "@cimo/package_name": "file:package_name-x.x.x.tgz"
- npm run build
- npm login --auth-type=legacy
- npm publish --auth-type=legacy --access public
- Link for npm package -> https://www.npmjs.com/package/@cimo/pid
- Server.ts
...
import { Cp } from "@cimo/pid";
// Source
import * as ControllerTest from "../controller/Test";
...
const cp = new Cp();
ControllerTest.execute(cp);
...
- ControllerTest.ts
...
import { Cp } from "@cimo/cp";
...
export const execute = (cp: Cp) => {
cp.add("api", "", 0, (isExists, pidKey) => {
if (!isExists) {
cp.update(pidKey, "");
...
cp.remove(pidKey);
// Action completed.
} else {
// Another action still running.
}
});
};
...