From c1b0d3aca0fff9e445eed2b5e938cb7034fc3f69 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Fri, 29 Oct 2021 00:55:44 +0200 Subject: Cleaned main file --- src/short.nim | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src/short.nim') 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() -- cgit v1.2.3