Crates.io | pico-lang |
lib.rs | pico-lang |
version | 0.0.4 |
source | src |
created_at | 2020-08-16 11:21:02.414376 |
updated_at | 2020-08-25 19:55:27.804966 |
description | JSON Logic like language |
homepage | https://github.com/c0d3x42/pico-rs |
repository | https://github.com/c0d3x42/pico-rs |
max_upload_size | |
id | 277197 |
size | 152,191 |
A minimal and safe programming language expressed in JSON
cargo install pico-lang
cargo build
or just run it
cargo run
enable nats (incomplete)
cargo run --features srv_nats
JSON
formmated file that encapsulates your logic
see simple.json example rule file
start server with
cargo run -- --rules simple.json
submit rule execution
curl -X POST localhost:8000/submit -d '{"nochicken": 1}' -H 'Content-Type: application/json'
returns:
{"namespaced":{},"input":{"nochicken":1},"locals":{"enochicken":"must be no hens"}}
and with a chicken:
curl -X POST localhost:8000/submit -d '{"chicken": 1}' -H 'Content-Type: application/json'
returns:
{"locals":{"egg":"must have been layed"},"namespaced":{},"input":{"chicken":1}}
curl -v -X POST localhost:8000/submit -d '{"xp": "x1xxx", "y": "y2"}' -H 'Content-Type: application/json'
curl -v -X POST localhost:8000/submit -d '{"xp": "x1xxx", "y": "y2", "json": {"ja": "rules}}' -H 'Content-Type: application/json'
wrk -t 5 -c 40 -s bench/sub.lua http://localhost:8000/submit