Git Product home page Git Product logo

simple-crud-express-mysql's Introduction

Simple CRUD API with Express JS and MYSQL

BOOK API

Requirements

  • Node.js
  • MySQL
  • Npm

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/books-crud-api.git
    cd books-crud-api
    
  2. Install Dependencies

    npm install
    
  3. Configure the Database and Table

    CREATE DATABASE express_mysql;
    USE express_mysql;
    CREATE TABLE Books (id INT AUTO_INCREMENT PRIMARY KEY, title VARCHAR(100) NOT NULL, author VARCHAR(100) NOT NULL);
    
  4. Start application

    nodemon .
    

Endpoints

  1. FIND ALL

    • URL: /books
    • METHOD: Get
    • Response :
      [
           {
               "id": 2,
               "title": "book 1",
               "author": "author X"
           }
       ]
      
  2. FIND BY ID

    • URL: /books/{id}
    • METHOD: Get
    • Response :
      {
         "id": 2,
         "title": "book 1",
         "author": "author X"
      }
      
  3. DELETE BOOK

    • URL: /books/{id}
    • METHOD: Delete
    • Response :
      {
         "message": "Book deleted successfully"
      }
      
  4. ADD BOOK

    • URL: /books
    • METHOD: Post
    • Request Body:
      {
         "title": "new book",
         "author": "author X"
      }
      
    • Response:
      {
         "id": 7,
         "title": "new book",
         "author": "author X"
      }
      
  5. UPDATE BOOK

    • URL: /books/{id}
    • METHOD: Put
    • Request Body:
      {
         "title": "new book update",
         "author": "author A"
      }
      
    • Response:
      {
         "message": "Book updated successfully"
      }
      

simple-crud-express-mysql's People

Contributors

elvinhndrwn avatar

Watchers

 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.