concierge

command module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: MIT Imports: 2 Imported by: 0

README

Concierge

A tiny URL shortener written in Go.

I've been exploring Go with the intention of using it to build microservices; this is a learning project to understand Go code structure, the Echo web framework, and GORM (a PostgreSQL ORM).

Concierge ("one who keeps the entrance to an edifice") is a JSON-based REST API which takes a valid alias and returns the corresponding URL via a HTTP 301 redirect. There's also a management endpoint to create (or preview existing) records. Once records are created they can't be removed or modified via the API.

API Specification

/ - Root
  • GET
    Returns documentation about the API and its endpoints.
  • GET - Requires an alias URL parameter.
    Share links to this endpoint with your target audience.
    Returns a redirection HTTP 301 response to the corresponding URL of the supplied alias. All redirections are prefixed with https:// automatically for security reasons.
  • GET - Requires an alias URL parameter.
    Returns metadata about an existing entry matching the alias, its creation date, and the corresponding URL.

  • POST - Requires an alias URL parameter and a url query parameter.
    If the alias is vacant, a new unique record will be created for the provided url.

Deployment Instructions

Concierge can be run as a Docker container and uses internal port :3000.
The latest release image of abiddiscombe/concierge can be pulled from Docker Hub.

The API server is backed by PostgreSQL; the following environment variables are required:

  • CONCIERGE_PG_HOST - PostgreSQL Server URL
  • CONCIERGE_PG_PORT - PostgreSQL Server Port
  • CONCIERGE_PG_NAME - PostgreSQL Database Name
  • CONCIERGE_PG_USER - PostgreSQL Connection User
  • CONCIERGE_PG_PASS - PostgreSQL Connection Password

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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