Created a per-post hitcount as well a writedata() function that can
write to a particular index or to a whole data type
This commit is contained in:
@@ -124,12 +124,3 @@ export function render_md(content) {
|
||||
return md.render(content)
|
||||
};
|
||||
|
||||
// Literally just +1 to the hitcount
|
||||
export function increment_hitcount() {
|
||||
if (config.data_storage == 'json') {
|
||||
let other_data = require('../data/data.json');
|
||||
other_data.hitcount += 1
|
||||
console.log(`/ Is loaded, hitcount: ${other_data.hitcount}`)
|
||||
fs.writeFileSync(`../data/data.json`, `${JSON.stringify(other_data)}`, 'utf-8');
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user