Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mr687/simple-go-rest-api
Restful API use GIN, GORM, and auth with JWT
https://github.com/mr687/simple-go-rest-api
gin golang gorm jwt
Last synced: 27 days ago
JSON representation
Restful API use GIN, GORM, and auth with JWT
- Host: GitHub
- URL: https://github.com/mr687/simple-go-rest-api
- Owner: mr687
- Created: 2022-08-05T19:12:47.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-08-05T19:58:16.000Z (over 2 years ago)
- Last Synced: 2024-06-21T18:04:21.318Z (6 months ago)
- Topics: gin, golang, gorm, jwt
- Language: Go
- Homepage:
- Size: 64.5 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# RESTful API - Golang
A simple RESTful API using [gin-gonic](https://github.com/gin-gonic/gin) for the web framework and [gorm](https://gorm.io) for the database ORM. This project is using Repository Pattern to separate the database and the business logic.
The project includes the following features:
* RESTful API endpoint
* Standard CRUD operations
* Data validation
* GEO IP lookup
* [JWT](https://jwt.io/)-based authentication
* Database migration
* Postman documentation and API testingNote:
* The geoip info service is provided by [freegeoip.live](https://freegeoip.live) that may not be available when you try this project:(## Getting Started
Please follow [the instructions](https://golang.org/doc/install) to install Go on your local machine. This project requires **Go 1.17 or higher+**.We also need to install [Docker](https://www.docker.com/get-started) if you want to try the project without setting your own environment.
After all done, run the following commands to start the project:
```bash
# Clone this repo
git clone https://github.com/mr687/simple-go-rest-api.git# Go to the project directory
cd simple-go-rest-api# Install dependencies
go mod init# Duplicate the .env.example file to .env and fill in your own values
cp .env.example .env# Run postgreSQL database via Docker compose
docker compose up -d
# docker-compose up -d# Start the rest server
go run main.go# Server running default on http://localhost:8080
```## API Documentation
The API documentation is hosted on [Postman Doc](https://documenter.getpostman.com/view/1838168/Uze1uio4).