https://github.com/kenpusney/tiger
https://github.com/kenpusney/tiger
Last synced: 10 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/kenpusney/tiger
- Owner: kenpusney
- Created: 2018-09-08T01:17:22.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-11-16T17:05:31.000Z (about 6 years ago)
- Last Synced: 2025-03-17T03:33:59.358Z (10 months ago)
- Language: TypeScript
- Homepage: http://kimleo.net/tiger
- Size: 482 KB
- Stars: 0
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# tiger-server

Tiger server is a very lightweight server for very simple process like webhooks.
## Usage
```
npm install tiger-server --save
```
and create `server.js`:
```js
const { Tiger, http, cron, mail } = require("tiger-server")
const tiger = new Tiger({});
tiger.use(http)
tiger.use(cron)
tiger.use(mail)
tiger.define({ id: "hello", target: "zmq:hello", process: function (state, message) {
tiger.log(`Message received: ${JSON.stringify(message)}`)
}})
tiger.define({ id: "cron", target: "cron:*/5 * * * * *", process: function ({ count = 0 }) {
count++;
tiger.notify("zmq:hello", { count })
return { count }
}});
tiger.define({ id: "request", target: "http:/hello", process: function (state, { req, res }) {
tiger.notify("zmq:hello", { message: "request recieved" });
res.send("success!")
}})
tiger.serve();
```
Just run `node server.js` then you can now see these modules interactions.
> Logo is generated from [Wikipedia](https://en.wikipedia.org/wiki/File:Ghostscript_Tiger.svg), the original script is under GPL license.