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.
GET
Returns documentation about the API and its endpoints.
GET- Requires analiasURL parameter.
Share links to this endpoint with your target audience.
Returns a redirectionHTTP 301response to the corresponding URL of the supplied alias. All redirections are prefixed withhttps://automatically for security reasons.
-
GET- Requires analiasURL parameter.
Returns metadata about an existing entry matching the alias, its creation date, and the corresponding URL. -
POST- Requires analiasURL parameter and aurlquery parameter.
If thealiasis vacant, a new unique record will be created for the providedurl.
Concierge can be run as a Docker container and uses port 3000. The latest release image of abiddiscombe/concierge can be pulled from Docker Hub.
Concierge uses PostgreSQL to persist data. The following environment variables are required to connect to a PostgreSQL server:
CONCIERGE_PG_HOST- DB URLCONCIERGE_PG_PORT- DB PortCONCIERGE_PG_NAME- DB NameCONCIERGE_PG_USER- DB UserCONCIERGE_PG_PASS- DB Password
Concierge uses the log/slog package to print structured logs. These can be captured and ingested by a supported third-party syslog service.