Skip to content

UtkarshM-hub/Go_CRUD_API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go_CRUD_API

This is an API build using golang, gin to handle routing and mongodb as a database.

#Installation Guide

  • Clone this repo into your local directory using following command
git clone git@github.com:UtkarshM-hub/Go_CRUD_API.git
  • update the environment variable MONGODB_URI in .env file to your cluster URI. To setup the cluster checkout this site.
  • If you haven't installed go yet then check the go site to download go
  • Run following command
go mod download && go run .

Congratulations🥳🎊 you've completed the setup of GO_CRUD_API on your local machine

#Routes

  1. /
  • / route creates a post in the data base.
  • Make a POST request to localhost:8080 and the structue of request body should be like following
{
 "Title":"ENTER_THE_TITLE",
 "Article":"ENTER_THE_ARTICLE_DATA",
 }
  1. /post/:postId
  • This route sends the post as a response
  • The METHOD of request is GET
  1. /update/:postId
  • This route updates the post
  • The METHOD of request is UPDATE
  • The request body should be like one showed in / route
  1. /delete/:postId
  • This route is used to delete the post
  • The METHOD of request is DELETE

#Screenshots for example

Request screenshot
Database screenshot

About

A CRUD_API developed using golang

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published