World Conquest Chronicles

World Conquest Chronicles

go-link-shortener-backend, v1.5

Back-end of the service for shorting links.

Formatting a counter as an integer number in the 62 base when generating link codes.

Change Log

  • generating link codes:
    • formatting a counter as an integer number in the 62 base.

Features

  • RESTful API:
    • link model:
      • creating by an URL;
      • getting by a code;
    • representing in a JSON:
      • payloads:
        • of requests;
        • of responses;
      • errors;
  • generating link codes:
    • using a version 4 UUID;
    • using sequential counters:
      • formatting:
        • formatting a counter as an integer number in the 10 base;
        • formatting a counter as an integer number in the 62 base;
      • storing:
        • storing in a database only counters chunks;
        • storing counters themselves in memory;
      • sharding:
        • sharding counters chunks;
        • selecting a shard of a counter chunk at random;
  • server:
    • additional routing:
      • redirecting to the link URL by its code;
      • serving static files;
    • storing settings in environment variables;
    • supporting graceful shutdown;
    • logging:
      • logging requests;
      • logging errors;
    • panics:
      • recovering on panics;
      • logging of panics;
  • databases:
    • storing links in the MongoDB database;
    • storing counters chunks in the etcd database:
      • using a record version as a counter chunk;
    • caching links in the Redis database;
  • distributing:

Repository

Link: https://github.com/thewizardplusplus/go-link-shortener-backend/tree/v1.5.

Content: code.

License: MIT.