Skip to content

Commit

Permalink
done
Browse files Browse the repository at this point in the history
  • Loading branch information
ringabout committed Aug 31, 2020
1 parent 12754a0 commit 08ab6ea
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 15 deletions.
11 changes: 5 additions & 6 deletions src/loguepkg/create.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os, strformat
import tml / [app, urls, views]


proc getEnvContent(appName: string): string =
Expand All @@ -21,15 +22,13 @@ proc initProject(projName: string) =
viewsFile = projName / "views.nim"
envFile = projName / ".env"

let path = currentSourcePath().splitPath.head
# let path = currentSourcePath().splitPath.head

copyFile(path / "tml" / "app.nim", appFile)
copyFile(path / "tml" / "urls.nim", urlsFile)
copyFile(path / "tml" / "views.nim", viewsFile)
writeFile(appFile, appStr)
writeFile(urlsFile, urlsStr)
writeFile(viewsFile, viewsStr)
writeFile(envFile, getEnvContent(projName))



proc init*(name: seq[string]) =
if name.len == 0:
echo "Please give the name of your project!"
Expand Down
9 changes: 0 additions & 9 deletions src/loguepkg/tml/.env

This file was deleted.

2 changes: 2 additions & 0 deletions src/loguepkg/tml/app.nim
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const appStr* = """
import prologue
import ./urls
Expand All @@ -15,3 +16,4 @@ let
var app = newApp(settings = settings)
app.addRoute(urls.urlPatterns, "/")
app.run()
"""
2 changes: 2 additions & 0 deletions src/loguepkg/tml/urls.nim
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const urlsStr* = """
import prologue
import ./views
Expand All @@ -7,3 +8,4 @@ let urlPatterns* = @[
# strip latter
pattern("/", hello)
]
"""
2 changes: 2 additions & 0 deletions src/loguepkg/tml/views.nim
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
const viewsStr* = """
import prologue
proc hello*(ctx: Context) {.async.} =
resp "<h1>Hello, Prologue!</h1>"
"""

0 comments on commit 08ab6ea

Please sign in to comment.