diff options
author | terminaldweller <thabogre@gmail.com> | 2021-04-10 05:46:34 +0000 |
---|---|---|
committer | terminaldweller <thabogre@gmail.com> | 2021-04-10 05:46:34 +0000 |
commit | 849e1df9b269d8cb7e1fb918a8200f60a085318a (patch) | |
tree | bcb0ef183aabaf6228712e005459872682bcc17b /server.js | |
parent | trying to add syntax highlighting for markdown (diff) | |
download | blog-849e1df9b269d8cb7e1fb918a8200f60a085318a.tar.gz blog-849e1df9b269d8cb7e1fb918a8200f60a085318a.zip |
added a dockerfile. fixed the relative path issues
Diffstat (limited to 'server.js')
-rwxr-xr-x | server.js | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -20,23 +20,25 @@ const mit = require("markdown-it")({ html: true }) }); const app = express(); -app.use(express.static("./")); +app.use(express.static(__dirname)); app.use(express.static(path.join(__dirname, "css"))); -app.set("views", "./views"); +app.set("views", path.join(__dirname, "views")); app.set("view engine", "ejs"); app.engine("ejs", require("ejs").__express); app.get("/", (req, res) => { - let readStream = fs.createReadStream("./mds/cstruct2luatable.md", "utf-8"); + let readStream = fs.createReadStream( + path.join(__dirname, "mds/cstruct2luatable.md"), + "utf-8" + ); // FIXME-this is gonna be so wrong when the md is bigger than one chunk readStream.on("data", (chunk) => { res.render("index", { data: { blogHttp: mit.render(chunk), - mds: ["c struct to lua table", "lazy makefiles", "telegram lua"], + mds: fs.readdirSync(path.join(__dirname, "mds"), "utf-8"), }, }); - console.log(mit.render(chunk)); }); }); |