Files
sentinela-go/internal/api/routes.go
Rainbow f7c8b446bf feat: Sentinela v0.2.0 — Brazilian Financial Data API in Go
- 20 Go source files, single 16MB binary
- SQLite + FTS5 full-text search (pure Go, no CGO)
- BCB integration: Selic, CDI, IPCA, USD/BRL, EUR/BRL
- CVM integration: 2,524 companies from registry
- Fiber v2 REST API with 42 handlers
- Auto-seeds on first run (~5s for BCB + CVM)
- Token bucket rate limiter, optional API key auth
- Periodic sync scheduler (configurable)
- Graceful shutdown, structured logging (slog)
- All endpoints tested with real data
2026-02-10 11:15:54 -03:00

39 lines
1.0 KiB
Go

package api
import (
"github.com/gofiber/fiber/v2"
"github.com/sentinela-go/internal/api/handlers"
"github.com/sentinela-go/internal/db"
)
func RegisterRoutes(app *fiber.App, database *db.DB) {
h := handlers.New(database)
app.Get("/health", h.Health)
v1 := app.Group("/api/v1")
v1.Get("/companies", h.ListCompanies)
v1.Get("/companies/search", h.SearchCompanies)
v1.Get("/companies/:id", h.GetCompany)
v1.Get("/companies/:id/filings", h.CompanyFilings)
v1.Get("/filings", h.ListFilings)
v1.Get("/filings/search", h.SearchFilings)
v1.Get("/filings/recent", h.RecentFilings)
v1.Get("/filings/:id", h.GetFiling)
v1.Get("/market/selic", h.ListSelic)
v1.Get("/market/selic/current", h.CurrentSelic)
v1.Get("/market/cdi", h.ListCDI)
v1.Get("/market/cdi/current", h.CurrentCDI)
v1.Get("/market/ipca", h.ListIPCA)
v1.Get("/market/ipca/current", h.CurrentIPCA)
v1.Get("/market/fx", h.ListFX)
v1.Get("/market/fx/current", h.CurrentFX)
v1.Get("/market/overview", h.MarketOverview)
v1.Get("/search", h.GlobalSearch)
}