Skip to content

Ryadel/NodeJS-Express-CRUD-API-Sample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NodeJS Express CRUD API Sample

A simple and effective CRUD API built using Node.js and Express. This project serves as a lightweight boilerplate for developers who want to create RESTful Web APIs with basic CRUD functionalities (Create, Read, Update, Delete) in Node.js using the Express framework.

Features

  • Lightweight and minimal setup
  • Built entirely with Node.js and Express
  • In-memory data storage (no external database required)
  • Full CRUD endpoints:
    • GET /api/items – Retrieve all items
    • GET /api/items/:id – Retrieve an item by ID
    • POST /api/items – Create a new item
    • PUT /api/items/:id – Update an existing item
    • DELETE /api/items/:id – Delete an item

Requirements

  • Node.js v14 or higher
  • npm (Node package manager)

Getting Started

  1. Clone this repository or download the ZIP.

  2. Navigate to the project folder:

cd NodeJS-Express-CRUD-API-Sample
  1. Install dependencies:
npm install
  1. Start the server:
npm start

The API server will be running at:

http://localhost:3000

Example Endpoints

You can test the API using tools like Postman or curl.

Create an Item

POST /api/items
Content-Type: application/json

{
  "name": "My New Item"
}

Get All Items

GET /api/items

Get a Specific Item

GET /api/items/1

Update an Item

PUT /api/items/1
Content-Type: application/json

{
  "name": "Updated Item"
}

Delete an Item

DELETE /api/items/1

Notes

  • This project uses an in-memory JavaScript array to store data. All items are lost when the server restarts.
  • The code is fully self-contained and meant for educational purposes, prototyping, and quick tests.
  • No database is required or configured.

Further Reading

For a detailed explanation and walkthrough of the code, please refer to the original article published on Ryadel.com:

📄 License

This project is open-source and available under the MIT License.

About

Sample project illustrating how to create a basic CRUD API in Node.JS using the Express framework

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published