Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/adhir2099/go-gin-restapi

Go Rest API using Gin
https://github.com/adhir2099/go-gin-restapi

api-rest gin go golang gorilla-mux gorm mysql

Last synced: about 6 hours ago
JSON representation

Go Rest API using Gin

Awesome Lists containing this project

README

        

![GO](https://img.shields.io/badge/GO-47d1ed?style=for-the-badge&logo=go&logoColor=white)

👋 GO-GIN REST API

# GO-GIN REST API
Rest API using Go's Gin! and gorilla mux

## Backend





## Included imports
* Gorilla mux
* Gorm
* Gin
* MySQL driver

## Initialize

Initialize Go's API

Get to the directory


Configure your server you want to listen, by default is in 8080


go run main.go

Running migration

go run migration/migrate.go


If you add more fields to the model, you have to update the controller as well

DB connection

```go
dsn := "user:@password/database?charset=utf8mb4&parseTime=True&loc=Local"
```


If you're not using any password just leave it this way:@/database

Testing insomnia/postman/thunder client

localhost:8080/api/v1/users


GET(getById)/PUT/DELETE : localhost:8080/api/v1/users/:id

## Contributing

1. Fork it!
2. Create your feature branch: `git checkout -b your-branch`
3. Commit your changes: `git commit -am 'Add some feature'`
4. Push to the branch: `git push origin your-branch`
5. Submit a PR

Get in touch with me:



adhir2099


Created with ❤️ by Adhir2099