Skip to content

byteB8/RESTful-CRUD

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Overview

RESTful API with CRUD Operations using Node.js and Express

Features

Operations implemented: task

  • Create new resource
  • Read existing resource(s)
  • Update existing resource
  • Delete existing resource

Requirements

  • Node.js (version >= 10)
  • npm (Node Package Manager) or yarn

Installation

  1. Clone the repository: git clone https://github.com/KumaarBalbir/RESTful-CRUD.git
  2. Navigate to the project directory: cd RESTful-CRUD
  3. Install dependencies: npm install

Usage

  1. Start the server: npm start (nodemon)
  2. The server will start running on http://localhost:3000 by default.

Endpoints

  • GET /users: Retrieve all users.
  • GET /users/:id: Retrieve a specific user by ID.
  • POST /users: Create a new user.
  • PUT /users/:id: Update an existing user by ID.
  • DELETE /users/:id: Delete a user by ID.

Request and Response Formats

Create User (POST /users)

Request Body:

{
  "firstName": "Balbir",
  "lastName": "Prasad",
  "age": "23"
}

Get users (GET /users)

Response

[
{
  "id": "user-id",
  "firstName": "Balbir",
  "lastName": "Prasad",
  "age": "23"
},
{
  "id": "user-id",
  "firstName": "John",
  "lastName": "Doe",
  "age": "25"
},

]

Get user (GET /users/:id)

Response

{
  "id": "id",
  "firstName": "Balbir",
  "lastName": "Prasad",
  "age": "23"
}

Update user (PATCH /users/:id)

Request Body

{
  "age": "20"
}

Delete user (DELETE /users/:id)

Response: User with id 1234 deleted

About

This is a simple RESTful API project implemented in Node.js and Express, providing CRUD (Create, Read, Update, Delete) operations for managing resources.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors