038 #19

Merged
cereci5049 merged 1 commit from ayushman into main 2024-08-10 22:42:34 +02:00
4 changed files with 16 additions and 16 deletions
Showing only changes of commit a052c411ef - Show all commits

View file

@ -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"

View file

@ -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"]

View file

@ -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")

View file

@ -1,4 +1,4 @@
{% extends "view/partials/_master.nimja" %}
{% extends "../view/partials/_master.nimja" %}
{% block spheader1 %} Sign Up {% endblock %}
{% block spheader2 %} Sign Up {% endblock %}