first posts
This commit is contained in:
12
dist/main.js
vendored
12
dist/main.js
vendored
@ -12,11 +12,16 @@ app.engine('pag', (filePath, options, callback) => {
|
||||
if (err) {
|
||||
return callback(new Error(err.message));
|
||||
}
|
||||
let renderedPhase1 = content.toString()
|
||||
let contentStr = content.toString();
|
||||
let pageOptionsStr = contentStr.replace(/^\s+<!-- (\{.*\}) -->.*$/, "\$1");
|
||||
logger.info(`contentStr: ${contentStr}`);
|
||||
logger.info(`pageOptionsStr: ${pageOptionsStr}`);
|
||||
let pageOptions = JSON.parse(pageOptionsStr);
|
||||
let renderedPhase1 = contentStr
|
||||
.replace('#bla#', 'blu');
|
||||
let renderedPhase2 = masterTmpl
|
||||
.replace('#maincontent#', renderedPhase1)
|
||||
.replace('#title#', options.title);
|
||||
.replace('#title#', pageOptions.title);
|
||||
return callback(null, renderedPhase2);
|
||||
});
|
||||
});
|
||||
@ -25,6 +30,9 @@ app.set('view engine', 'pag');
|
||||
app.get('/index', (req, res) => {
|
||||
res.render('index', { 'title': 'Projects - just for fun' });
|
||||
});
|
||||
app.get('/posts/:date', (req, res) => {
|
||||
res.render(`posts/${req.params.date}/article`, {});
|
||||
});
|
||||
app.get('/', (req, res) => {
|
||||
res.send('Hello world!');
|
||||
});
|
||||
|
Reference in New Issue
Block a user