Skip to content

vstdy/otus-highload

Repository files navigation

OTUS-Highload

OTUS Highload Architect course project.

REST API

By default, server starts at 8080 HTTP port with the following endpoints:

  • POST /login — login user;
  • POST /user/register — register user;
  • GET /user/get/{id} — get user data;
  • GET /user/search — get users data by name;

For details check out http-client.http file

Code

Packages used

App architecture and configuration:

Networking:

SQL database interface provider:

  • pgx - Go driver and toolkit for PostgreSQL;
  • scany - scanner toolkit;

CLI

All CLI commands have the following flags:

  • --log_level: (optional) logging level (default: info);
  • --config: (optional) path to configuration file (default: ./config.yaml);
  • --timeout: (optional) request timeout (default: 5s);
  • -d --database_url: (optional) database source name (default: postgres://user:password@localhost:5432/project?sslmode=disable);

Root only command flags:

  • -a --server_address: (optional) server address (default: 0.0.0.0:8080);

If config file not specified, defaults are used. Defaults can be overwritten using ENV variables.

Migrations

project migrate up --config ./my-confs/config-1.yaml

Command migrates DB to the latest version

project migrate down --config ./my-confs/config-1.yaml

Command rolls back a single migration from the current version

How to run

Docker

docker-compose -f build/docker-compose.yml up

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages