Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/utkarshm-hub/go_crud_api

A CRUD_API developed using golang
https://github.com/utkarshm-hub/go_crud_api

crud-api go golang mongodb

Last synced: 24 days ago
JSON representation

A CRUD_API developed using golang

Awesome Lists containing this project

README

        

# 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
```bash
git clone [email protected]: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
```bash
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
```JSON
{
"Title":"ENTER_THE_TITLE",
"Article":"ENTER_THE_ARTICLE_DATA",
}
```
2. ```/post/:postId```
* This route sends the post as a response
* The METHOD of request is ```GET```
3. ```/update/:postId```
* This route updates the post
* The METHOD of request is ```UPDATE```
* The request body should be like one showed in ```/``` route
4. ```/delete/:postId```
* This route is used to delete the post
* The METHOD of request is ```DELETE```

## #Screenshots for example

Request
screenshot

Database
screenshot