Code Monkey home page Code Monkey logo

todo-ws-actix's Introduction

TODO - WEBSERVICE - ACTIX

Introduction

This is a simple Todo Rest service.

The application contains the basic CRUD elements, and write in a Postgres database provided in a Docker container. For the SQL instructions the POC uses an Rust implementation off MyBatis (Experimental). The Rest entry points are secured with KeyCloak and exchanges a JWT Token.

Running

Starting the Docker Compose file that includes a Postgres Database with 2 Schema’s:

  • Schema Todo (Application)

  • Schema KeyCloak (KeyCloak Application)

docker compose start

compile the application:

cargo build

run the application:

cargo run

Testing

For testing you can use Postman or like I prefer from IntelliJ the http files, see folder http. Some samples:

Retrieving an JWT Token

POST http://127.0.0.1:8888/realms/learn-rust-realm/protocol/openid-connect/token
Content-Type: application/x-www-form-urlencoded

client_id=learn-rust-client&username=student&password=password&grant_type=password

Retrieving the list of Todo’s

GET http://127.0.0.1:8080/api/todo
Authorization: Bearer {{token}}
Accept: application/json

Adding a Todo

POST http://127.0.0.1:8080/api/todo
Authorization: Bearer {{token}}
Content-Type: application/json

{
  "owner": "ME",
  "name": "ME",
  "description": "Learn Rust",
  "status": "OPEN"
}

Next Steps

Feel free to explore the different options of the Actix Framework. An alternative implementation follows in my next exploration.

todo-ws-actix's People

Contributors

oxide-byte avatar

Stargazers

 avatar

Watchers

 avatar

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.