Skip to content

This Repository Contain The Crud operation with Expressjs and RedixDb

Notifications You must be signed in to change notification settings

Nishit-Archive/Redis_Crud

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Node.js Redis API

This Node.js application demonstrates how to connect to a Redis database, establish a server, and handle API requests. You can use this as a starting point for building your own API with Redis integration. 🌟

Prerequisites

Before getting started, make sure you have the following prerequisites installed on your system:

  • Node.js (v14 or higher)
  • Redis (Make sure Redis is installed and running locally or on a remote server)

Setup

  1. Clone this repository to your local machine:

    git clone https://github.com/Nishit-Archive/Redis_Crud/
    cd Redis_Crud
  2. Install the project dependencies:

    npm install
  3. Create a .env file in the project root directory with the following content:

    REDIS_PASSWORD=your_redis_password
    REDIS_HOST=your_redis_host

    Replace your_redis_password with your Redis password and your_redis_host with your Redis host (e.g., localhost).

Usage

Starting the Server

To start the Node.js server, run the following command:

npm run start/dev

The server will start on port 3000 by default.

Making a GET Request

You can make a GET request to the root endpoint to test the server's connection to Redis:

curl http://localhost:3000

This should return a response with the message "Hello World!" and the value stored in the Redis database.

Making a POST Request

To create a user, make a POST request to the /createuser endpoint. You can use tools like Postman or curl to make POST requests.

Example using curl:

curl -X POST -H "Content-Type: application/json" -d '{
  "username": "your_username",
  "email": "your_email@example.com",
  "password": "your_password"
}' http://localhost:3000/createuser

Replace "your_username", "your_email@example.com", and "your_password" with the user information you want to create.


Feel free to customize this README to include additional information about your project or specific usage instructions.

About

This Repository Contain The Crud operation with Expressjs and RedixDb

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published