https://github.com/bsgbryan/jyn
A simple, fun, fully asynchronous api framework - built on madul
https://github.com/bsgbryan/jyn
Last synced: 6 months ago
JSON representation
A simple, fun, fully asynchronous api framework - built on madul
- Host: GitHub
- URL: https://github.com/bsgbryan/jyn
- Owner: bsgbryan
- License: mit
- Created: 2017-05-01T05:13:58.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-09-21T17:25:54.000Z (over 2 years ago)
- Last Synced: 2025-05-13T12:16:45.615Z (8 months ago)
- Language: JavaScript
- Size: 258 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
    
# Jyn
A simple, fun, fully asynchronous web socket server
# Install
```sh
npm install -g @bsgbryan/jyn
```
# Usage
```sh
jyn
```
That's it. _Really_.
For command options, execute `jyn --help`
# Handling requests
jyn is built on [Mädūl](https://github.com/bsgbryan/madul). It bootstraps and invokes the madul specified by the `action` property of the JSON web socket request, executes the method requested, and returns the results.
What does this look like in practice?
1. `mkdir ~/jyn_test && cd ~/jyn_test`
1. `npm install -g wscat`
1. `jyn`
1. ``echo 'const madul = { greet: ({ name }) => `Hello ${name}!` }\n' > ./casian.js``
1. `wscat -c ws://localhost:1138`
1. `{"action": "casian.greet", "name": "World"}`
This should result in the response `{"result": "Hello World!"}`