Git Product home page Git Product logo

gosql_bookmanagement's Introduction

GoSQL - CRUD API USING GORM AND POSTGRES

GoSQL is a simple CRUD application built in Go using Gorilla Mux and GORM, which provides a RESTful API for managing books.

Features

  • Retrieve a list of movies
  • Retrieve a single movie by ID
  • Create a new movie
  • Update an existing movie
  • Delete a movie by ID

Prerequisites

Make sure you have Go installed on your machine. You can download and install it from here.

Dependencies

  • Gorilla Mux: A powerful HTTP router and URL matcher for building Go web servers with routing capabilities.
  • GORM: An Object Relational Mapping library for Go. It provides a simple and efficient way to work with SQL databases.

Installation

  1. Clone the repository:

    git clone https://github.com/Yash-sudo-web/gosql_bookmanagement.git
    
  2. Navigate to the project directory:

    cd cmd/main
    
  3. Build and run the application:

    go build . && ./main
    

API Endpoints

  • GET /book/{id}: Get details of a book by ID.
  • GET /book/: Get details of all books.
  • POST /book/: Create a new book.
  • PUT /book/{id}: Update details of a book by ID.
  • DELETE /book/{id}: Delete a book by ID.

Usage

You can use tools like cURL or Postman to interact with the API endpoints. Here are some examples:

  • Get all books:

    curl http://localhost:8000/book/
    
  • Get a book by ID:

    curl http://localhost:8000/book/1
    
  • Create a new book:

    curl -X POST -H "Content-Type: application/json" -d '{ "name": "The Great Gatsby", "author": "F. Scott Fitzgerald", "publication": "Scribner" }' http://localhost:8000/book/
    
  • Update an existing movie:

    curl -X PUT -H "Content-Type: application/json" -d '{ "name": "The Great Gatsby", "author": "F. Scott Fitzgerald", "publication": "Scribner" }' http://localhost:8000/book/1
    
  • Delete a movie by ID:

    curl -X DELETE http://localhost:8000/book/1
    

Contributing

Contributions are welcome! Feel free to open issues or submit pull requests.

License

This project is licensed under the MIT License.

gosql_bookmanagement's People

Contributors

yash-sudo-web 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.