Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/utkarshm-hub/go_crud_api
- Owner: UtkarshM-hub
- License: mit
- Created: 2022-09-15T10:16:32.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-09-16T09:34:55.000Z (over 2 years ago)
- Last Synced: 2024-11-07T20:56:23.343Z (3 months ago)
- Topics: crud-api, go, golang, mongodb
- Language: Go
- Homepage:
- Size: 15.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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
Database