started making pre-start script to auto generate md -> html before starting the server. best i can do for now

This commit is contained in:
len0rd 2018-07-30 16:59:41 -04:00
parent 432e408a2c
commit ec4931db34
3 changed files with 6 additions and 3 deletions

View file

@ -4,7 +4,8 @@
"description": "src for lenords.net",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "echo \"Error: no test specified\" && exit 1",
"prestart": "echo waddup"
},
"repository": {
"type": "git",

1
prestart-buildmd.sh Normal file
View file

@ -0,0 +1 @@
echo "Building HTML partials from markdown"

View file

@ -1,3 +1,4 @@
const PORT = 8090;
var express = require('express');
var app = express();
@ -10,7 +11,7 @@ app.set('view engine', 'ejs');
app.use(express.static(__dirname + '/assets'));
app.get(/\/.*/, function(req, res) {
console.log(req.path);
console.log('Request for page: ' + req.path);
let pathname = 'pages' + req.path;
if ((pathname)[pathname.length - 1] === '/') {
@ -20,4 +21,4 @@ app.get(/\/.*/, function(req, res) {
res.render(pathname);
});
app.listen(8090);
app.listen(PORT);