Giter Site home page Giter Site logo

rs-kv's Introduction

Rust Warp backend server

This is a Rust Warp backend kv server. Change from Rust-Warp-Example.

How to test it

You can use $python3 dev.py or $cargo run --bin main or $RUST_LOG=debug cargo run --bin main to test a web server.

If you want to start simple, start with hello and hi apis.

You can also test other CLI commands with cargo run --bin name. Refer to Cargo.toml for that.

End points

I let CURL commands for each files in routes/ folder to help you test the end points. But, you can start with these first.

  • Register a user
$curl -X POST localhost:8000/api/user/v1 -H "Content-Type: application/json" -d '{ "email": "[email protected]", "password": "password" }'
  • List users
$curl localhost:8000/api/user/v1
  • Login
curl -X POST localhost:8000/api/user/v1/login -c cookie.txt -H "Content-Type: application/json" -d '{ "email": "[email protected]", "password": "password" }'
  • Update cash
$curl -X PATCH localhost:8000/api/user/v1/cash -b cookie.txt -L -H "Content-Type: application/json" -d '{ "amount": 100000 }'
  • Delete a user
$curl -X GET localhost:8000/api/user/v1/logout -b cookie.txt -L
  • hget
curl -X POST localhost:8000/api/user/v1/hget -b cookie.txt -L -H "Content-Type: application/json" -d '{"table": "table1",  "key": "hello"}'
  • hset
curl -X POST localhost:8000/api/user/v1/hset -b cookie.txt -L -H "Content-Type: application/json" -d '{"table": "table1",  "key": "hello", "value":  "world"}'
  • hgetall
curl -X GET localhost:8000/api/user/v1/hgetall/table1 -b cookie.txt -L
  • hmset
curl -X POST localhost:8000/api/user/v1/hmset -b cookie.txt -L -H "Content-Type: application/json" -d '{"table": "table1", "pairs":  [ {"key": "hello", "value":  "world"},  {"key": "hello2", "value":  "world2"}]}'
  • hmget
curl -X POST localhost:8000/api/user/v1/hmget -b cookie.txt -L -H "Content-Type: application/json" -d '{"table": "table1", "keys":  ["hello", "hello2"]}'
  • hdel
curl -X POST localhost:8000/api/user/v1/hdel -b cookie.txt -L -H "Content-Type: application/json" -d '{"table": "table1", "keys":  ["hello"]}'
  • hmdel
curl -X POST localhost:8000/api/user/v1/hmdel -b cookie.txt -L -H "Content-Type: application/json" -d '{"table": "table1", "keys":  ["hello"]}'
  • hexist
curl -X POST localhost:8000/api/user/v1/hexist -b cookie.txt -L -H "Content-Type: application/json" -d '{"table": "table1", "keys":  ["hello"]}'
  • hmexist
curl -X POST localhost:8000/api/user/v1/hmexist -b cookie.txt -L -H "Content-Type: application/json" -d '{"table": "table1", "keys":  ["hello"]}'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.