const express = require("express"), chokidar = require("chokidar"), fs = require("fs"), path = require("path"), showdown = require("showdown"), mkthtml = new showdown.Converter() mkthtml.setFlavor("github") const PORT = process.env.PORT || 8080 var dataPath = path.join(__dirname, 'data') var postsPath = path.join(dataPath, 'posts') var staticPath = path.join(__dirname, 'static') var watcher = chokidar.watch(postsPath) var app = express() app.use(express.static(staticPath)) var reqPaths = [dataPath, postsPath] for (var i = 0; i < reqPaths.length; i++) { var p = reqPaths[i] if (!fs.existsSync(p)) { fs.mkdirSync(p) } } app.listen(PORT, () => { console.log("Violet's Limbo is now listening on: " + PORT) }) function pageUpdate() { var postsArray = fs.readdirSync(postsPath).reverse() var html = "" for (var i = 0; i < postsArray.length; i++) { var addedHTML = "" var post = postsArray[i] addedHTML += `