Initial support for static files

This commit is contained in:
Quad 2022-04-11 08:56:19 +02:00
parent e40b453118
commit bc2a428432
3 changed files with 8 additions and 2 deletions

View File

@ -1,4 +1,5 @@
import prologue import prologue
import prologue/middlewares/staticfile
import templating import templating
proc getIndex*(ctx: Context) {.async.} = proc getIndex*(ctx: Context) {.async.} =
@ -8,10 +9,11 @@ proc runWebsite(settings: Table) =
let prologueSettings = newSettings( let prologueSettings = newSettings(
debug = settings["debug"] debug = settings["debug"]
) )
let website = newApp(settings = prologueSettings) var website = newApp(settings = prologueSettings)
website.get("/", getIndex) website.get("/", getIndex)
website.use(staticFileMiddleware("static"))
website.run() website.run()
export runWebsite export runWebsite

View File

@ -1,8 +1,11 @@
<html> <html>
<head> <head>
<title>Example</title> <title>Example</title>
<style rel="stylesheet" href="/static/css/master.css"></style>
</head> </head>
<body> <body>
{% block content %}{% endblock %} <div>
{% block content %}{% endblock %}
</div>
</body> </body>
</html> </html>

1
static/css/master.css Normal file
View File

@ -0,0 +1 @@
/* Nothing here yet */