Skip to content

nightbarron/redis_restapi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Redis REST API

Run

docker run -d -p 8080:8080 redis-rest:latest

Structure

type RedisDataModel struct {
Key    string `json:"key"`
Value  string    `json:"value"`
Expire int    `json:"expire" default:"0"`
}

Details

Key Types Description Value Default
key string Key string *
Value string Value string *
Expire int Time for Expired int (second) 0: non expired

* : required

Get Version

API Endpoint
GET /v1/version
Request

curl -L -X GET 'localhost:8080/v1/version'

Respond
{
  "success": true,
  "message": "Version 1.0.0"
}

GET KEY

API Endpoint
GET /v1/keys/:key
Request

curl -L -X GET 'localhost:8080/v1/keys/:keyexample'

Respond
{
  "success": true,
  "message": "Get key from Redis server",
  "data": {
    "key": "keyexample",
    "value": "1",
    "expire": 0
  }
}

PUT KEY

API Endpoint
PUT /v1/keys
Request
curl -L -X PUT 'localhost:8080/v1/keys' 
--header 'Content-Type: application/json' 
--data '{
"key": "keyexample",
"value": 1,
"expire": 10
}'
Respond
{
  "success": true,
  "message": "Put key to Redis server",
  "data": {
    "key": "keyexample",
    "value": 1,
    "expire": 10
  }
}

DELETE KEY

API Endpoint
DELETE /v1/keys/keyexample
Request
`curl -L -X DELETE 'localhost:8080/v1/keys/:keyexample'`
Respond
{
  "success": true,
  "message": "Delete key from Redis server"
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published