Crates.io | corolla |
lib.rs | corolla |
version | 0.3.2 |
source | src |
created_at | 2023-10-30 00:00:08.193562 |
updated_at | 2024-04-22 18:12:05.644601 |
description | "your liteweight backend" |
homepage | |
repository | |
max_upload_size | |
id | 1017868 |
size | 119,817 |
Corolla is a a lightweight SQLite web server. You can use it as a bare-bones web framework.
This Git repostiory includes example Corolla specs, which are JSON files that define a Corolla server's available queries, DB schema, and conversions.
To run the example Corolla spec:
Install Rust.
Clone this Git repository and navigate into it:
git clone https://github.com/janie314/corolla
cd corolla
cargo run -- -s examples/example_spec.json
Now you can make write queries to the database:
# curl -s -X POST http://localhost:50000/write/write01 \
-H 'content-type: application/json' \
-d '{ "vacation_spot": "sandringham" }'
... And read queries!
# curl -s http://localhost:50000/read/read01 | jq
[
[
"vacation_spot"
],
[
"sandringham"
]
]
Usage: corolla [OPTIONS]
Options:
-d, --db <DB> Filepath to the SQLite database [default: corolla.sqlite3]
-p, --port <PORT> Choose a port to listen on [default: 50000]
-r, --route <ROUTE> Base URL for API endpoints [default: ]
-s, --spec <SPEC> Filepath to the spec.json file [default: spec.json]
-t, --test Test mode?
-h, --help Print help
-V, --version Print version
Available via npm at corolla_api
.
See the js_api folder and README for more information.
Issues and pull requests welcome!
Uses Rust's testing framework and Bun's test command.
To test the Corolla server:
cargo test
To test the JS/TS API:
bun test
cargo update
git push --tags
.cargo publish