aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJulien Dessaux2021-10-29 00:55:44 +0200
committerJulien Dessaux2021-10-29 00:55:44 +0200
commitc1b0d3aca0fff9e445eed2b5e938cb7034fc3f69 (patch)
tree502f0b89ca339dd5a408f31e16a4c0ebd036b4c8 /src
parentcosmetics (diff)
downloadshort-c1b0d3aca0fff9e445eed2b5e938cb7034fc3f69.tar.gz
short-c1b0d3aca0fff9e445eed2b5e938cb7034fc3f69.tar.bz2
short-c1b0d3aca0fff9e445eed2b5e938cb7034fc3f69.zip
Cleaned main file
Diffstat (limited to 'src')
-rw-r--r--src/short.nim7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/short.nim b/src/short.nim
index 7057779..19f905e 100644
--- a/src/short.nim
+++ b/src/short.nim
@@ -63,7 +63,6 @@ proc handleIndexPost(params: Table[string, string]): (HttpCode, string) {.raises
if match(v, titleRegexp):
input.Title = v
else:
- echo "title"
return (Http400, renderError(400, "Bad Request"))
except RegexError:
return (Http500, renderError(500, "RegexError"))
@@ -72,7 +71,6 @@ proc handleIndexPost(params: Table[string, string]): (HttpCode, string) {.raises
discard parseUri(v)
input.Url = v
except:
- echo "url"
return (Http400, renderError(400, "Bad Request"))
of "expires":
try:
@@ -80,12 +78,10 @@ proc handleIndexPost(params: Table[string, string]): (HttpCode, string) {.raises
except ValueError:
return (Http400, renderError(400, "Bad Request"))
if exp < 1 or exp > 527040:
- echo "exp"
return (Http400, renderError(400, "Bad Request"))
of "shorten": discard
else: return (Http400, renderError(400, "Bad Request"))
if input.Title == "" or input.Url == "" or exp == 0:
- echo "empty"
return (Http400, renderError(400, "Bad Request"))
input.Token = $genOid()
input.Created = times.now()
@@ -117,4 +113,5 @@ routes:
var (code, content) = handleToken(@"token")
resp code, content
-runForever()
+when isMainModule:
+ runForever()