added directory check to init when making index md file

This commit is contained in:
Ro 2020-07-20 13:02:47 -07:00
parent 575fea388b
commit ad09a61ab7

View file

@ -206,13 +206,15 @@ router.post('/init', function (req, res) {
'---\n' +
index.content;
fs.writeFile('content/pages/index.md', init)
.then(() => {
console.log('index file created');
})
.catch(err => {
console.log('ERROR', err);
});
fs.ensureDir('content/pages/').then(() => {
fs.writeFile('content/pages/index.md', init)
.then(() => {
//console.log('index file created');
})
.catch(() => {
//console.log('ERROR', err);
});
});
});
res.json({