mirror of
https://github.com/len0rd/personal-website.git
synced 2025-03-01 03:51:57 -05:00
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:
parent
432e408a2c
commit
ec4931db34
|
@ -4,7 +4,8 @@
|
||||||
"description": "src for lenords.net",
|
"description": "src for lenords.net",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
"test": "echo \"Error: no test specified\" && exit 1",
|
||||||
|
"prestart": "echo waddup"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|
1
prestart-buildmd.sh
Normal file
1
prestart-buildmd.sh
Normal file
|
@ -0,0 +1 @@
|
||||||
|
echo "Building HTML partials from markdown"
|
|
@ -1,3 +1,4 @@
|
||||||
|
const PORT = 8090;
|
||||||
var express = require('express');
|
var express = require('express');
|
||||||
var app = express();
|
var app = express();
|
||||||
|
|
||||||
|
@ -10,7 +11,7 @@ app.set('view engine', 'ejs');
|
||||||
app.use(express.static(__dirname + '/assets'));
|
app.use(express.static(__dirname + '/assets'));
|
||||||
|
|
||||||
app.get(/\/.*/, function(req, res) {
|
app.get(/\/.*/, function(req, res) {
|
||||||
console.log(req.path);
|
console.log('Request for page: ' + req.path);
|
||||||
let pathname = 'pages' + req.path;
|
let pathname = 'pages' + req.path;
|
||||||
|
|
||||||
if ((pathname)[pathname.length - 1] === '/') {
|
if ((pathname)[pathname.length - 1] === '/') {
|
||||||
|
@ -20,4 +21,4 @@ app.get(/\/.*/, function(req, res) {
|
||||||
res.render(pathname);
|
res.render(pathname);
|
||||||
});
|
});
|
||||||
|
|
||||||
app.listen(8090);
|
app.listen(PORT);
|
Loading…
Reference in a new issue