Skip to content

oliverpauffley/urlshortener

Repository files navigation

Url Shortener

A web api/cli program to shorten urls.

Usage

Web Api

To build the web api run go run main.go in the cmd/webserver folder.

Then then hit the server with a json post request at 8000/url to generate a shorten url. Json should be in the form:

{
 "long_url": "http://<your_url_here>" 
}

The web api will then redirect when you direct a browser to the given url.

Cli

To build the cli version run go run main.go in the cmd/cli folder.

Then run the program created.

TODO:

  • Better error handling. Could DRY in lots of areas. See: Behaviour type assertion
  • System to remove old urls. Would be sensible to remove urls over a certain age (maybe check if they have been used recently?)

About

A golang web api/cli to shorten urls

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages