When writing a blogpost, the user has full control on what to show - HTML, CSS and JS. But what if the user want's to access data from the database, e.g. inserting the blog posts publication date just beneath the blog post heading?
Proposal:
Define certain strings, which would be replaced on rendering.
Problems:
It is to my knowledge not possible to query a string from the DB and execute Nim-code within it.
Suggestion:
I can't seem to find an elegant solution to this, so my proposal is:
Prepare a multiReplace() on the queried string from the DB with certain elements such as publication date, views, category.
Example
# user edits a blog post from the browser interface
<div id="mainContainer" class="blogpost">
<h1>New blog</h1>
<div>${category}</div>
<div>${views}</div>
<div>
# routes
get "/blog/newblogpage":
let data = query-DB-to-fetch-data()
resp data.multiReplace([("${category}", "Cats"), ("${views}", viewCount)])
When writing a blogpost, the user has full control on what to show - HTML, CSS and JS. But what if the user want's to access data from the database, e.g. inserting the blog posts publication date just beneath the blog post heading?
Proposal:
Define certain strings, which would be replaced on rendering.
Problems:
It is to my knowledge not possible to query a string from the DB and execute Nim-code within it.
Suggestion:
I can't seem to find an elegant solution to this, so my proposal is:
multiReplace()
on the queried string from the DB with certain elements such as publication date, views, category.Example
Before
After