https://github.com/filp/tooty
Simple agnostic message router for node.
https://github.com/filp/tooty
Last synced: 3 months ago
JSON representation
Simple agnostic message router for node.
- Host: GitHub
- URL: https://github.com/filp/tooty
- Owner: filp
- License: mit
- Created: 2015-06-03T13:11:58.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-06-03T19:42:16.000Z (over 10 years ago)
- Last Synced: 2025-08-12T19:40:19.296Z (5 months ago)
- Language: JavaScript
- Homepage:
- Size: 137 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# tooty [](https://circleci.com/gh/filp/tooty)
Simple agnostic message router for node.

```js
import tooty from "tooty";
router = tooty.build((r) => {
// Define routes:
r.route("users:fire", myUsersHandler.fire);
});
// You get your handler back, and can do whatever you wish
// with it from here on:
var handler = router.dispatch("users:fire", additionalData);
```
### You can use it for:
- Routing socket.io events to handlers
- Routing chat bot actions to action handlers
- Dispatching messages in a worker queue to the workers
- Etc etc etc, you get the idea, right?
### Features
- Simple, reliable router system that takes a path/action and returns a handler
- Fancy (and very readable) route builder inspired by Rails' `Rails.application.routes#draw` (optional)
- Abstract enough that it can fit all your routing needs with a small amount of fidgeting
### Installation
```shell
$ npm install --save tooty
```
#### ES6
Tooty is written using ES6 features. In development, it uses the [Babel](https://github.com/babel/babel) library.
Before being published to npm, the library is compiled automatically to ES5 (through the `prepublish` command defined in
the `package.json` file)
### Authors
`tooty` was developed by [Filipe Dobreira](https://github.com/filp). Contributions to the code are very welcome!
### License
`tooty` is distributed under the MIT license. See `LICENSE`.