Giter VIP home page Giter VIP logo

shrine2000 / go-crud Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 858 KB

This repository contains a CRUD (Create, Read, Update, Delete) API built using the Go programming language and the Gin web framework. The API allows you to perform basic operations on a "Post" model, including creating new posts, listing all posts, retrieving a specific post by ID, updating a post, and deleting a post.

Go 100.00%
crud crud-api gin go golang gorm postman postman-test

go-crud's Introduction

Go CRUD API

This is a basic CRUD API built with Go and Gin framework. It provides endpoints to create, read, update and delete posts.

Installation and Usage

To run the API, you will need to have Golang and a PostgreSQL database installed on your machine. You will also need to create a .env file with your database credentials.

  1. Clone the repository: git clone https://github.com/shrine2000/go-crud.git
  2. Install dependencies: go mod download
  3. Create a .env file with your database credentials
  4. Run the application: go run main.go

The API will be available at http://localhost:8080.

Endpoints

  • POST /posts - creates a new post with a title and body
  • GET /posts - retrieves a list of all posts
  • GET /posts/:id - retrieves a single post by its ID
  • PUT /posts/:id - updates a post by its ID
  • DELETE /posts/:id - deletes a post by its ID

Screenshots

Create

Update

Fetch

Delete

Testing

The API endpoints can be tested using the included Postman configuration file located at go-crud/postman/Post.postman_collection.json. Import this file into your Postman application and use it to test the API endpoints.

Contributing

If you would like to contribute to this project, please fork the repository and submit a pull request.

License

This project is licensed under the MIT License.

go-crud's People

Contributors

shrine2000 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.