Giter Site home page Giter Site logo

sauravhathi / nodejs-express-crud-api Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 28 KB

This is a simple CRUD REST API built with Node.js and Express. It uses an in-memory array to store data, so it will not persist data after the server is stopped. It is intended to be used as a starting point for learning how to build a REST API with Node.js and Express. ๐Ÿ’ป๐Ÿ“š

License: MIT License

JavaScript 100.00%
crud-api expressjs lovely-professional-university nodejs nodemon rest-api sauravhathi

nodejs-express-crud-api's Introduction

Simple CRUD REST API with Node.js and Express ๐Ÿ“๐Ÿš€

This is a simple CRUD REST API built with Node.js and Express. It uses an in-memory array to store data, so it will not persist data after the server is stopped. It is intended to be used as a starting point for learning how to build a REST API with Node.js and Express. ๐Ÿ’ป๐Ÿ“š

Built With ๐Ÿ› ๏ธ

  • Node.js - JavaScript runtime
  • Express - Web framework for Node.js
  • Nodemon - Utility to monitor for changes and automatically restart the server

Endpoints ๐Ÿ›ฃ๏ธ

  • GET all data ๐Ÿ“„ : GET /
  • GET data by ID ๐Ÿ”Ž : GET /:id
  • POST new data โœ๏ธ : POST /
  • PUT update data by ID โœ๏ธ : PUT /:id
  • DELETE data by ID ๐Ÿ—‘๏ธ : DELETE /:id

Data Structure ๐Ÿ“Š

The data is stored as an array of objects, where each object represents a book. Each book has the following properties:

  • id (integer): a unique identifier for the book
  • title (string): the title of the book
  • author (string): the author of the book
  • genre (string): the genre of the book

How to Run ๐Ÿƒโ€โ™€๏ธ๐Ÿƒโ€โ™‚๏ธ

  1. Install dependencies: npm install
  2. Run the server: npm start
  3. Make requests to http://localhost:3000

How to Use ๐Ÿค”

If your using vscode, you can use the Thunder Client extension to make requests to the API. You can also use Postman.

GET all data ๐Ÿ“„

Make a GET request to http://localhost:3000 to get all data.

GET data by ID ๐Ÿ”Ž

Make a GET request to http://localhost:3000/:id to get data by ID.

POST new data โœ๏ธ

Make a POST request to http://localhost:3000 with the following JSON data in the request body to create a new data entry:

{
  "title": "string",
  "author": "string",
  "genre": "string"
}

PUT update data by ID โœ๏ธ

Make a PUT request to http://localhost:3000/:id with the following JSON data in the request body to update data by ID:

{
  "title": "string",
  "author": "string",
  "genre": "string"
}

DELETE data by ID ๐Ÿ—‘๏ธ

Make a DELETE request to http://localhost:3000/:id to delete data by ID.

Author ๐Ÿ‘ฉโ€๐Ÿ’ป๐Ÿ‘จโ€๐Ÿ’ป

Saurav Hathi

License ๐Ÿ“„

This project is licensed under the MIT License - see the LICENSE.md file for details

nodejs-express-crud-api's People

Contributors

sauravhathi avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.