Skip to content

samayun/restapi-hiredis-cplusplus

Repository files navigation

CPP rest sdk Hiredis Restful Api by C++

Pre requirement

  • OS - Linux preferd
  • Docker
  • Docker Compose

Before run cpp file install docker & docker-compose must

Installation and Commands

// Build container and run redis on local pc
sudo make build
// run the c++ program
bash run.sh

image

image

CRUD using Terminal (Curl)

image

Database Dashboard

image

CREATE USER

 curl -X POST -H "Content-Type: application/json" -d '{"id":"1", "name":"John", "age":"30"}' http://localhost:8080/users

GET USER

curl http://localhost:8080/users/1

UPDATE

curl -X PUT -H "Content-Type: application/json" -d '{"name":"John Doe", "age":"35"}' http://localhost:8080/users/1

UPDATE

Delete a user (DELETE):

curl -X DELETE http://localhost:8080/users/1