This project demonstrates how to build a simple in-memory key-value store using Node.js. The store supports basic Redis-like commands such as SET
, GET
, and DELETE
.
- Node.js installed on your machine
npm
(Node Package Manager) installed
-
Clone the repository or download the source code.
-
Navigate to the project directory.
-
Install the dependencies by running:
npm install
To start the server, run the following command:
npm start
The server will start and listen on port 3001.
Connecting to the Server You can use telnet to connect to the server and issue commands. Open a terminal and run:
telnet localhost 3001
Supported Commands
- SET key value: Sets the value for the specified key.
- GET key: Retrieves the value for the specified key.
- DELETE key: Deletes the specified key.
Example Usage
telnet localhost 3001
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
SET mykey myvalue
>> OK
GET mykey
>> myvalue
DELETE mykey
>> OK
GET mykey
>> NULL