Git Product home page Git Product logo

rnotes's Introduction

rnotes

RNotes is a simple notes service written in Rust that developed as a "graduation" project for my learning path to Rust language.

Rust Ferris

It is consist of three modules:

  • rnotes_core: which contains de DB and API models.
  • rnotes_server: the API server that process the request of the notes services.
  • rnotes_cli: a command line client for the rnotes services.

(*) Although I have made a big effort to follow the best practices of RUST language, you could find many bug and unrecommended patterns. So try to be gentle with my code ๐Ÿ˜†.

Development

Requisites

  • Rust nightly

    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
    rustup toolchain install nightly
    rustup override set nightly
    rustup component add rls rust-analysis rust-src
  • Cargo

  • Docker & Docker Compose

Building

  • Local build

    make build
  • Docker build

    make docker-build

Using local PostgreSQL

  • Start

    docker_compose_up
  • Delete

    docker_compose_down

Usage

Launch rnotes_server

  1. Docker build

    docker-compose up -d
  2. Start servers

    docker-compose up -d

Launch requests

Run rnotes_cli

docker exec -it $(docker ps -aq -f name=rnotes) /rnotes_cli

Rest API

  • Login

    TOKEN=$(curl -Ss -d '{
        "email": "[email protected]",
        "password": "1464ACD6765F91FCCD3F5BF4F14EBB7CA69F53AF91B0A5790C2BBA9D8819417B"
    }'  --header "Content-Type: application/json" http://127.0.0.1:8080/auth/login | jq -r '.jwt_token')
  • Get all notes of the user

    curl -vSs -H "Authorization: Bearer ${TOKEN}" http://127.0.0.1:8080/notes
  • Create a note

    curl -Ss -v -H "Authorization: Bearer ${TOKEN}" --header "Content-Type: application/json" -d '{
    "category_id": null,
    "title": "note_XXX_user_a",
    "data": "some_text_note_XXX_user_a"
    }' http://127.0.0.1:8080/notes | jq
  • Get a note

    curl -Ss -v -H "Authorization: Bearer ${TOKEN}" http://127.0.0.1:8080/notes/{NOTE_ID} | jq
  • Update a note

    curl -Ss -v -X PUT -H "Authorization: Bearer ${TOKEN}" --header "Content-Type: application/json" -d '{
    "category_id": null,
    "title": "note_XXX_user_a_other",
    "data": "some_text_note_XXX_user_a_other"
    }' http://127.0.0.1:8080/notes/{NOTE_ID} | jq

rnotes's People

Contributors

alvsanand avatar

Stargazers

 avatar  avatar

Watchers

 avatar James Cloos avatar

rnotes's Issues

Shell CLI

In order to ease the access to the REST API, a shell cli will help interacting with the notes server

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.