concierge

command module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 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 APIs and microservices, and 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 that 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 have been created, they cannot be removed or modified via the API.

API Endpoints

/ - Root
  • GET
    Returns documentation about the API and its listed endpoints.
  • GET - Requires a valid alias query-parameter.
    Returns metadata about an existing alias entry, creation date, and the corresponding URL.

  • POST - Requires valid alias and url query-parameters.
    If the alias is vacant, the API will confirm creation of the new record. Returns an error message if the alias is occupied.

  • GET - Requires a valid alias url-parameter.
    Returns a redirection (HTTP 301) response to the corresponding URL via HTTPS.

Deployment Instructions

Concierge can be run as a Docker container and uses port 3000.
You can pull the image abiddiscombe/concierge from Docker Hub.

The server stores data in 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