Skip to content

adityaraj607/simple-database

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Simple Key-Value Store API

A lightweight RESTful API for storing and retrieving key-value pairs in memory using Flask.

Endpoints

Store a Key-Value Pair

GET /store?key=<key>&value=<value>

Parameters:

  • key (required): The key to store
  • value (required): The value to associate with the key

Success Response:

{
  "status": "ok",
  "key": "your_key",
  "value": "your_value"
}

Error Response (400 Bad Request):

{
  "error": "missing key or value"
}

Retrieve a Value by Key

GET /get?key=<key>

Parameters:

  • key (required): The key to look up

Success Response:

{
  "key": "your_key",
  "value": "your_value"
}

Error Responses:

  1. Missing key (400 Bad Request):
{
  "error": "missing key"
}
  1. Key not found (404 Not Found):
{
  "error": "not found",
  "key": "non_existent_key"
}

Running the Application

  1. Install the required dependency:
pip install flask
  1. Run the application:
python index.py

The server will start on http://0.0.0.0:8000

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages