This is a simple url-shorten service written in Go, based on gin framework and MongoDB. To manage dependencies i use govendor.
{
"url": "string",
"keep_for_days": "int"
}
keep_for_days
could be ommited and have to be >= 0. If keep_for_days
== 0, the entry is deleted right after server returns it's url by id.
200
:
{
"url": "string",
"valid_until": "string"
}
url
contains short url code
valid_until
is a datetime string yyyy-mm-dd HH:MM:ss.f +z
400
:
{
"error": "string"
}
error
containes error description
301
withLocation
header containing the original url404
if url_id can not be found