docker run -d -p 8080:8080 redis-rest:latest
type RedisDataModel struct {
Key string `json:"key"`
Value string `json:"value"`
Expire int `json:"expire" default:"0"`
}
Key |
Types |
Description |
Value |
Default |
key |
string |
Key |
string |
* |
Value |
string |
Value |
string |
* |
Expire |
int |
Time for Expired |
int (second) |
0: non expired |
* : required
API Endpoint |
GET /v1/version |
curl -L -X GET 'localhost:8080/v1/version'
{
"success": true,
"message": "Version 1.0.0"
}
API Endpoint |
GET /v1/keys/:key |
curl -L -X GET 'localhost:8080/v1/keys/:keyexample'
{
"success": true,
"message": "Get key from Redis server",
"data": {
"key": "keyexample",
"value": "1",
"expire": 0
}
}
API Endpoint |
PUT /v1/keys |
curl -L -X PUT 'localhost:8080/v1/keys'
--header 'Content-Type: application/json'
--data '{
"key": "keyexample",
"value": 1,
"expire": 10
}'
{
"success": true,
"message": "Put key to Redis server",
"data": {
"key": "keyexample",
"value": 1,
"expire": 10
}
}
API Endpoint |
DELETE /v1/keys/keyexample |
`curl -L -X DELETE 'localhost:8080/v1/keys/:keyexample'`
{
"success": true,
"message": "Delete key from Redis server"
}