advanced-url-shortener

command module
v0.0.0-...-1d517b5 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: MIT Imports: 5 Imported by: 0

README

GitHub License GitHub go.mod Go version Go Report Card

⚠️ This project is currently under development. However, the current version is functional.

URL SHORTENER - SPECS

  • A sign up page
  • A sign in page
  • Create a new short URL page
  • A short URL should have a URL that it points to
    • A name
    • An ID
    • A flag that keeps track whether the short URL is active and accessible - if this is set to false by the user it the short url should give 404
  • List URLS page
    • Users should be able to delete individual lists here
    • Users should be able to bulk delete lists here
    • Users should be able to order by creation date, update date, and clicks
  • A detail page
    • Users should be able to delete and edit the URL - AKA where it points to, if it is active, change the name etc. but the id should be read only
    • It should contain stats on the URL
      • How many times it has been clicked
      • IP addresses of the clicks
      • Device info of the clicks
      • Mobile vs Desktop

HOW TO USE API

Auth API

Login
  • POST /api/auth/login
    • Authenticate user.
    • Request Body:
      {
          "email": "umitanilkilic@gmail.com",
          "password": "pikacu123"
      }
      
Register
  • POST /api/auth/register
    • Register a new user.
    • Request Body:
      {
          "email": "umitanilkilic@gmail.com",
          "password": "pikacu123"
      }
      
URL Management
Get URL Details
  • GET /api/auth/urls/:urlId
    • Retrieve details of a specific URL.
Get URLs (with Pagination)
  • GET /api/auth/urls
    • Retrieve URLs with pagination.
    • Query Parameters:
      • limit: Number of URLs per page (default: 20).
      • page: Page number (default: 1).
Create URL
  • POST /api/auth/urls/
    • Create a new shortened URL.
    • Request Body:
      {
          "name": "example",
          "long": "https://example.com",
          "alias": "example",
          "expires_at": "2022-01-01T00:00:00Z"
      }
      
Delete URLs (Bulk)
  • DELETE /api/auth/urls/
    • Delete multiple URLs at once.
    • Request Body:
      {
          "urls_ids": ["url_id1", "url_id2"]
      }
      
Delete URL
  • DELETE /api/auth/urls/:urlId
    • Delete a specific URL.
Update URL
  • PATCH /api/auth/urls/:urlId
    • Update details of a specific URL.
    • Request Body:
      {
          "active": true,
          "alias": "example",
          "name": "example",
          "long": "https://example.com",
          "expires_at": "2022-01-01T00:00:00Z"
      }
      
Get URL Stats
  • GET /api/auth/urls/stats/:urlId
    • Get statistics of a specific URL.

Environment Variables

This application relies on the following environment variables for proper functioning:

  • APP_ADDRESS: Specifies the address where the application is accessible.
  • DATABASE_URL: Specifies the URL for the database connection. (Postgres)
  • AUTH_SECRET: Specifies the secret key used for authentication and session management.
  • REDIS_URL: Specifies the URL for the Redis database connection.

Please ensure that these environment variables are correctly configured for the successful operation of the application.

TODO

  • Dockerize the application
  • Improve configuration management
  • Add tests
  • Add UI
  • Redis integration for caching

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
api

Jump to

Keyboard shortcuts

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