Edit path for the metrics.json

This commit is contained in:
Raphael 2024-01-13 17:17:31 +01:00
parent d1d8311b9d
commit bc4df4dd5e
2 changed files with 3 additions and 3 deletions

View File

@ -1,7 +1,7 @@
const fs = require("fs") const fs = require("fs")
const path = require("path") const path = require("path")
var metricsPathFile = metricsPathFile var metricsPathFile = "./metrics.json"
module.exports.getDate = function (formated) { module.exports.getDate = function (formated) {
@ -52,7 +52,7 @@ module.exports.setMetricsFile = (path) => {
module.exports.getMetricsFile = () => { module.exports.getMetricsFile = () => {
if(!fs.existsSync()) { if(!fs.existsSync(metricsPathFile)) {
fs.writeFileSync(metricsPathFile, JSON.stringify([], null, 2)) fs.writeFileSync(metricsPathFile, JSON.stringify([], null, 2))
} else { } else {
return JSON.parse(fs.readFileSync(metricsPathFile)) return JSON.parse(fs.readFileSync(metricsPathFile))

View File

@ -1,6 +1,6 @@
{ {
"name": "webmetrik", "name": "webmetrik",
"version": "0.1.3", "version": "0.1.4",
"description": "NodeJS - npm package - Make metrics and make it available by making a httpServer", "description": "NodeJS - npm package - Make metrics and make it available by making a httpServer",
"main": "main.js", "main": "main.js",
"keywords": [], "keywords": [],