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

View File

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

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

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