Go-reusable-api is a highly performant, reusable, and easy-to-understand API built with Golang, Gin, and Gorm. This API is designed to offer a robust feature set while ensuring optimized performance and security.
- Cache Support: Utilizes Redis for caching.
- Database: PostgreSQL.
- Rate Limiting: Built-in rate limiter to prevent spam and service crashes.
- Docker Support: Includes Dockerfile for containerization.
- Monitoring: Prometheus integration for performance monitoring.
- Authentication: Bearer token and hashed passwords for security.
- Golang
- Docker
- PostgreSQL
- Redis
Execute the following commands to build and run the Docker container:
docker build -t go-reusable-api .
docker run -p 8080:8080 go-reusable-api
This file should contain one function called SetSalt
that returns the salt in byte type.
func SetSalt() []byte {
your_salt := "Hey"
return []byte(your_salt)
}
To ensure the highest level of performance, the API has:
- Cache optimization through Redis.
- Database indexes and optimized queries in PostgreSQL.
- Clean and efficient codebase.
- Passwords are hashed for secure storage.
- Bearer token is used for system authorization.
The API includes a Prometheus setup within the Docker container for real-time performance monitoring.
Examples for making API requests can be found in the config/rest
folder. This should guide you on how to properly make requests to the API.
Email
Password
Bearer Token
Remember to include your email, password, and the appropriate bearer token when making API calls.
Go-reusable-api é uma API altamente eficaz, reutilizável e fácil de entender, construída com Golang, Gin e Gorm. Esta API foi projetada para oferecer um conjunto de recursos robusto, mantendo um desempenho e segurança otimizados.
- Suporte a Cache: Utiliza Redis para cache.
- Base de Dados: PostgreSQL.
- Limitação de Taxa: Limitador de taxa embutido para prevenir spam e quedas do serviço.
- Suporte a Docker: Inclui Dockerfile para containerização.
- Monitoramento: Integração com Prometheus para monitoramento de desempenho.
- Autenticação: Token Bearer e senhas hash para segurança.
- Golang
- Docker
- PostgreSQL
- Redis
Execute os seguintes comandos para construir e executar o container Docker:
docker build -t go-reusable-api .
docker run -p 8080:8080 go-reusable-api
Este arquivo deve conter uma função chamada SetSalt
que retorna o salt em tipo byte.
func SetSalt() []byte {
seu_salt := "Hey"
return []byte(seu_salt)
}
Para garantir o mais alto nível de desempenho, a API possui:
- Otimização de cache através de Redis.
- Índices de base de dados e consultas otimizadas em PostgreSQL.
- Base de código limpa e eficiente.
- Senhas são hash para armazenamento seguro.
- Token Bearer é usado para autorização do sistema.
A API inclui uma configuração Prometheus dentro do container Docker para monitoramento de desempenho em tempo real.
Exemplos de como fazer requisições à API podem ser encontrados na pasta rest
. Isso deve orientá-lo sobre como fazer requisições adequadas à API.
Email
Senha
Token Bearer
Lembre-se de incluir seu e-mail, senha e token de portador apropriado ao fazer chamadas de API.