Skip to content

Commit

Permalink
Output what port the application is running on
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergio Tapia committed Jun 24, 2021
1 parent 30a9310 commit 1c7d23c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 0 additions & 1 deletion src/crawlers/leetx.nim
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ proc fetchLatest*() {.async.} =
discard insert_torrent(torrent)

proc startCrawl*() {.async.} =
echo "Doing it"
while true:
try:
await fetchLatest()
Expand Down
9 changes: 7 additions & 2 deletions src/torrentinim.nim
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import os
import json
import prologue
import strutils
import strformat

import prologue/middlewares/cors

Expand Down Expand Up @@ -45,10 +46,14 @@ when isMainModule:
resp jsonResponse(%results)

var allowOrigins = getEnv("ALLOW_ORIGINS", "")
let settings = newSettings(debug = false, port = Port(getEnv("TORRENTINIM_PORT", "50123").parseInt()))
let port = getEnv("TORRENTINIM_PORT", "50123").parseInt()
let settings = newSettings(debug = false, port = Port(port))
var app = newApp(settings = settings)
app.use(CorsMiddleware(allowOrigins = @[allowOrigins]))
app.addRoute("/", hello)
app.addRoute("/search", search)
app.addRoute("/hot", hot)
app.run()

echo &"Torrentinim is running, bambino. http://localhost:{port}"
app.run()

0 comments on commit 1c7d23c

Please sign in to comment.