examples/jsonrpsee_example/README.md
Modify the DATABASE_URL var in .env to point to your chosen database
Turn on the appropriate database feature for your chosen db in api/Cargo.toml (the "sqlx-sqlite", line)
Execute cargo run to start the server
Send jsonrpc request to server
curl --location --request POST 'http://127.0.0.1:8000' \
--header 'Content-Type: application/json' \
--data-raw '{"jsonrpc": "2.0", "method": "Post.Insert", "params": [
{
"id":0,
"title":"aaaaaaa",
"text":"aaaaaaa"
}
], "id": 2}'
curl --location --request POST 'http://127.0.0.1:8000' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"method": "Post.List",
"params": [
1,
100
],
"id": 2
}'
curl --location --request POST 'http://127.0.0.1:8000' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"method": "Post.Delete",
"params": [
10
],
"id": 2
}'
curl --location --request POST 'http://127.0.0.1:8000' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"method": "Post.Update",
"params": [
{
"id": 1,
"title": "1111",
"text": "11111"
}
],
"id": 2
}'
Run tests:
cd api
cargo test
Run migration:
cargo run -p migration -- up
Regenerate entity:
sea-orm-cli generate entity --output-dir ./entity/src --lib --entity-format dense --with-serde both