Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thanhhaudev/openapi-go
📚 Simple Open API project written in Go
https://github.com/thanhhaudev/openapi-go
golang gorilla-mux gorm jwt learning-by-doing open-api practice-project rest-api tutorial
Last synced: about 2 months ago
JSON representation
📚 Simple Open API project written in Go
- Host: GitHub
- URL: https://github.com/thanhhaudev/openapi-go
- Owner: thanhhaudev
- Created: 2024-07-29T15:28:38.000Z (4 months ago)
- Default Branch: master
- Last Pushed: 2024-09-24T06:09:51.000Z (about 2 months ago)
- Last Synced: 2024-09-24T07:04:23.672Z (about 2 months ago)
- Topics: golang, gorilla-mux, gorm, jwt, learning-by-doing, open-api, practice-project, rest-api, tutorial
- Language: Go
- Homepage:
- Size: 192 KB
- Stars: 9
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
A simple Open API project written in Go.
![screenshot](https://github.com/thanhhaudev/openapi-go/blob/master/docs/screenshot.png?raw=true)
## Features
- Simple API endpoints
- Basic CRUD operations## Prerequisites
Before you begin, ensure you have met the following requirements:| Requirement | Description |
|--------------------|------------------------------------------------------------------------------------------------------------------------------|
| **Go** | Install Go from the [official website](https://golang.org/dl/). |
| **Docker** | Install Docker from the [official website](https://www.docker.com/get-started). |
| **Docker Compose** | Install Docker Compose from the [official website](https://docs.docker.com/compose/install/). |
| **golang-migrate** | Install golang-migrate from the [official documentation](https://github.com/golang-migrate/migrate/tree/master/cmd/migrate). |
| **air** | Install `air` command line tool by running `go install github.com/air-verse/air@latest`. |
| **swag** | Install `swag` command line tool by running `go install github.com/swaggo/swag/cmd/swag@latest`. |## Usage
1. **Build the application:**
```sh
make build
```
2. **Run the application:**
```sh
make up
```
Seed the database:
```sh
make migrate/up
```
3. **Access logs:**
```sh
make logs
```
4. **Restart the application:**
```sh
make restart
```
5. **Stop the application:**
```sh
make down
```## Access the API documentation:
- Open your browser and go to `http://localhost:8080/swagger/index.html`## Authentication sample data
Here are some sample tenants with their respective API keys and secrets for authentication:
| Tenant Name | API Key | API Secret | Scopes |
|----------------|----------------------|----------------------|-----------------------------|
| Default Tenant | KRY2oikKQ4DEgG5VOC57 | CJxNmBP07PfH1GYZqu1O | MANAGE_USER, MANAGE_MESSAGE |
| Tenant 1 | 6yDd4PnFH9MMIdGgOOkf | NWHZUUiqTqbIBGMfcLyS | MANAGE_USER |
| Tenant 2 | 4b7Ph2hsJP4ohC0tlw5J | 2UF9c2jvKsUfamAeISli | NONE |## Contributing
1. Fork the repository
2. Create your feature branch (`git checkout -b feature/fooBar`)
3. Commit your changes (`git commit -am 'Add some fooBar'`)
4. Push to the branch (`git push origin feature/fooBar`)
5. Create a new Pull Request