Merge pull request '038' (#19) from ayushman into main
Reviewed-on: #19
This commit is contained in:
commit
0cb58ad991
4 changed files with 16 additions and 16 deletions
|
@ -12,7 +12,7 @@ bin = @["hh1"]
|
|||
# Dependencies
|
||||
|
||||
requires "nim >= 2.0.8"
|
||||
requires "https://github.com/ire4ever1190/mike"
|
||||
requires "https://github.com/ire4ever1190/mike >= 1.3.3"
|
||||
requires "nimja"
|
||||
requires "https://codeberg.org/13thab/turso-nim"
|
||||
requires "https://github.com/euantorano/dotenv.nim"
|
|
@ -11,7 +11,7 @@ proc signup*(ctx: Context): string=
|
|||
var
|
||||
user1 = ctx.cookies.getOrDefault("user1", "none")
|
||||
user = to(parseJson(user1), User)
|
||||
compileTemplateFile(getScriptDir() / "view" / "signup.nimja")
|
||||
compileTemplateFile(".." / "view" / "signup.nimja", baseDir = getScriptDir())
|
||||
elif ctx.httpMethod == HttpPost:
|
||||
var
|
||||
firstName = ctx.urlForm["fn"]
|
||||
|
|
26
src/hh1.nim
26
src/hh1.nim
|
@ -19,55 +19,55 @@ import
|
|||
user1 = ctx.cookies.getOrDefault("user1", """{"none": "none"}""")
|
||||
echo user1
|
||||
# var user = to(parseJson(user1), User)
|
||||
compileTemplateFile(getScriptDir() / "view" / "index.nimja")
|
||||
compileTemplateFile("view" / "index.nimja", baseDir = getScriptDir())
|
||||
|
||||
"/shop" -> get:
|
||||
# var user = ctx.getUserFromCookie(ctx.cookies.getOrDefault("user", ""))
|
||||
# echo ctx.cookies.getOrDefault("user", "")
|
||||
var
|
||||
user1 = ctx.cookies.getOrDefault("user1", "none")
|
||||
user = to(parseJson(user1), User)
|
||||
compileTemplateFile(getScriptDir() / "view" / "shop.nimja")
|
||||
# user = to(parseJson(user1), User)
|
||||
compileTemplateFile("view" / "shop.nimja", baseDir = getScriptDir())
|
||||
|
||||
"/contact" -> get:
|
||||
var
|
||||
user1 = ctx.cookies.getOrDefault("user1", "none")
|
||||
user = to(parseJson(user1), User)
|
||||
compileTemplateFile(getScriptDir() / "view" / "contact.nimja")
|
||||
# user = to(parseJson(user1), User)
|
||||
compileTemplateFile("view" / "contact.nimja", baseDir = getScriptDir())
|
||||
|
||||
"/cart" -> get:
|
||||
# var user = ctx.getUserFromCookie(ctx.cookies.getOrDefault("user", ""))
|
||||
var
|
||||
user1 = ctx.cookies.getOrDefault("user1", "none")
|
||||
user = to(parseJson(user1), User)
|
||||
compileTemplateFile(getScriptDir() / "view" / "cart.nimja")
|
||||
# user = to(parseJson(user1), User)
|
||||
compileTemplateFile("view" / "cart.nimja", baseDir = getScriptDir())
|
||||
|
||||
"/checkout" -> get:
|
||||
var
|
||||
user1 = ctx.cookies.getOrDefault("user1", "none")
|
||||
user = to(parseJson(user1), User)
|
||||
compileTemplateFile(getScriptDir() / "view" / "checkout.nimja")
|
||||
compileTemplateFile("view" / "checkout.nimja", baseDir = getScriptDir())
|
||||
|
||||
"/shop/:id" -> get:
|
||||
var
|
||||
prodId = capitalizeAscii(ctx.pathParams["id"])
|
||||
user1 = ctx.cookies.getOrDefault("user1", "none")
|
||||
user = to(parseJson(user1), User)
|
||||
compileTemplateFile(getScriptDir() / "view" / "shop-detail.nimja")
|
||||
compileTemplateFile("view" / "shop-detail.nimja", baseDir = getScriptDir())
|
||||
|
||||
"/testimonial" -> get:
|
||||
var
|
||||
user1 = ctx.cookies.getOrDefault("user1", "none")
|
||||
user = to(parseJson(user1), User)
|
||||
compileTemplateFile(getScriptDir() / "view" / "testimonial.nimja")
|
||||
compileTemplateFile("view" / "testimonial.nimja", baseDir = getScriptDir())
|
||||
|
||||
"/signup" -> [get, post]: ctx.signup()
|
||||
# "/signup" -> [get, post]: ctx.signup()
|
||||
|
||||
"/login" -> get:
|
||||
var
|
||||
user1 = ctx.cookies.getOrDefault("user1", "none")
|
||||
# user = to(parseJson(user1), User)
|
||||
compileTemplateFile(getScriptDir() / "view" / "login.nimja")
|
||||
compileTemplateFile("view" / "login.nimja", baseDir = getScriptDir())
|
||||
"/htmx/login" -> post:
|
||||
var
|
||||
form = ctx.urlForm
|
||||
|
@ -137,7 +137,7 @@ import
|
|||
var
|
||||
user1 = ctx.cookies.getOrDefault("user1", "none")
|
||||
user = to(parseJson(user1), User)
|
||||
compileTemplateFile(getScriptDir() / "view" / "404.nimja")
|
||||
compileTemplateFile("view" / "404.nimja", baseDir = getScriptDir())
|
||||
|
||||
servePublic("src/public", "/static")
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{% extends "view/partials/_master.nimja" %}
|
||||
{% extends "../view/partials/_master.nimja" %}
|
||||
|
||||
{% block spheader1 %} Sign Up {% endblock %}
|
||||
{% block spheader2 %} Sign Up {% endblock %}
|
||||
|
|
Loading…
Reference in a new issue