aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorterminaldweller <thabogre@gmail.com>2022-07-06 11:24:39 +0000
committerterminaldweller <thabogre@gmail.com>2022-07-06 11:24:39 +0000
commitfc713bcbb320ff692cac6332f5aa587dc817305c (patch)
treec0f59a5ded32b58e413c2699c153ae017cb3fca6
parentnow the blog uses the db for everything. now need to decide on how to populat... (diff)
downloadblog-fc713bcbb320ff692cac6332f5aa587dc817305c.tar.gz
blog-fc713bcbb320ff692cac6332f5aa587dc817305c.zip
WIP, we now have to fix the pug template which is not working
-rw-r--r--model.js1
-rw-r--r--put_in_db.js26
-rwxr-xr-xserver.js6
-rw-r--r--views/rss_feed.pug2
4 files changed, 28 insertions, 7 deletions
diff --git a/model.js b/model.js
index 5df1270..dde3913 100644
--- a/model.js
+++ b/model.js
@@ -54,6 +54,7 @@ function populateDB(model) {
newBlogPost.save();
});
}
+
module.exports = {
blogPost: mongoose.model("BlogPost", BlogPostSchema),
dbInit: dbInit,
diff --git a/put_in_db.js b/put_in_db.js
new file mode 100644
index 0000000..da5a050
--- /dev/null
+++ b/put_in_db.js
@@ -0,0 +1,26 @@
+"use strict";
+// mongosh --host 127.0.0.1 --port 27117 -u mongo -p mongo -f put_in_db.js
+
+const fs = require("fs");
+const path = require("path");
+// db = connect("http://mongo:mongo@127.0.0.1:27117");
+
+blog_entry_1 = {
+ title: "Turning C structs into Lua tables",
+ slug: "c_struct_lua_table",
+ body: fs.readFileSync(path.join(__dirname) + "/mds/cstruct2luatable.md"),
+ teaser: "Turning C structures into Lua tables",
+ keywords: "c,lua",
+ lastUpdatedAt: Date.now(),
+};
+
+blog_entry_2 = {
+ title: "Lazy Makefiles",
+ slug: "lazy_makefile",
+ body: fs.readFileSync(path.join(__dirname) + "/mds/lazymakefiles.md"),
+ teaser: "Lazy Makefiles",
+ keywords: "makefile,c,c++",
+ lastUpdatedAt: Date.now(),
+};
+
+db.blogposts.insertMany([blog_entry_1, blog_entry_2]);
diff --git a/server.js b/server.js
index 4c2be0c..6d51d1b 100755
--- a/server.js
+++ b/server.js
@@ -123,12 +123,6 @@ app.get("/archive", (req, res) => {
},
});
});
- // res.render("archive.ejs", {
- // cache: true,
- // data: {
- // mds: fs.readdirSync(path.join(__dirname, "mds"), "utf-8"),
- // },
- // });
});
app.get("/robots.txt", (req, res) => {
diff --git a/views/rss_feed.pug b/views/rss_feed.pug
index 0ae2b74..e75225d 100644
--- a/views/rss_feed.pug
+++ b/views/rss_feed.pug
@@ -18,4 +18,4 @@ rss(version='2.0', xmlns:atom='<a href="http://www.w3.org/2005/Atom" rel="nofoll
p: a(href='<a href="https://blog.terminaldweller.com/blog/#{post.slug} rel="nofollow">https://blog.terminaldweller.com/blog/#{post.slug}</a>') 'Read more &raquo;'
| ]]>
pubDate= new Date(post.lastUpdatedAt).toUTCString()
- guid(isPermaLink='false') <a href="https://blog.terminaldweller.com/blog/#{post.slug}"
+ guid(isPermaLink='false') <a href="https://blog.terminaldweller.com/blog/#{post.slug}" rel="nofollow">https://blog.terminaldweller.com/blog/#{post.slug}</a>