9 releases

new 0.3.2 Apr 22, 2024
0.3.1 Apr 14, 2024
0.3.0 Mar 23, 2024
0.2.2 Mar 6, 2024
0.1.0 Oct 30, 2023

#155 in Database interfaces

Download history 4/week @ 2024-02-18 191/week @ 2024-02-25 280/week @ 2024-03-03 27/week @ 2024-03-10 60/week @ 2024-03-17 32/week @ 2024-03-24 17/week @ 2024-03-31 179/week @ 2024-04-14

288 downloads per month

BSD-3-Clause

34KB
738 lines

Corolla

Corolla is a a lightweight SQLite web server. You can use it as a bare-bones web framework.

Example

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:

  1. Install Rust.

  2. Clone this Git repository and navigate into it:

git clone https://github.com/janie314/corolla
cd corolla
  1. Start the Corolla server:
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

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

JavaScript API

Available via npm at corolla_api.

See the js_api folder and README for more information.

Development

Issues and pull requests welcome!

Testing

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

How to Take a Dependabot Update

  1. Rebase against dependabot branch.
  2. cargo update
  3. Run tests.
  4. Accept merge request.
  5. git tag current version, then git push --tags.
  6. cargo publish

Dependencies

~39–55MB
~1M SLoC