api

command module
v0.0.0-...-b8432e4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 5, 2023 License: MIT Imports: 11 Imported by: 0

README

Audio Guide Bot: API service

API service is a dockerized Golang application that serves Guide Bot API and webhook for Telegram Bot API.

Configuration

Required environment variables:

  • TELEGRAM_WEB_APP_URL - URL to Guide UI service
  • TELEGRAM_BOT_TOKEN - Telegram Bot token
  • TELEGRAM_PAYMENTS_TOKEN - Telegram Payments token
  • JWT_SECRET - Secret to sign and verify JWT tokens
  • DB_CONNECTION_STRING - URL to DB
  • S3_CONNECTION_STRING - URL to S3

Optional environment variables:

  • CORS_ALLOWED_ORIGINS - list of allowed origins that may access the resource

Service structure

Service is built on three abstractions:

  • Providers - isolate interaction with other systems or packages
  • Repositories - provide CRUD operations for data types, all interfaces are implemented as an aggregate repository object
  • Controllers - implement HTTP handlers with business logic, all handlers are implemented in compliance with JSend specification

All entities are constructed and injected in main and then HTTP handlers are served by Fiber.

Database migrations

API service can be started in database migration mode. In this case, it will apply migrations from the implemented DBProvider and exit. To start the service in migration mode - specify --migrate execution argument.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
provider
bot
db

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL