Compare commits

..

No commits in common. "d1d8311b9da5e638f3bda730c1b309257b470379" and "902f2812f0b3eb17413d050f1afcb9b5fb373150" have entirely different histories.

3 changed files with 5 additions and 16 deletions

View File

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

View File

@ -5,12 +5,6 @@
const basics = require('./basics.js'); const basics = require('./basics.js');
const fs = require('fs'); const fs = require('fs');
module.exports.setMetricFile = (path) => {
basics.setMetricsFile(path);
const metricsFile = basics.getMetricsFile();
}
module.exports.Metric = class { module.exports.Metric = class {
name; name;
description; description;

View File

@ -1,6 +1,6 @@
{ {
"name": "webmetrik", "name": "webmetrik",
"version": "0.1.3", "version": "0.1.0",
"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": [],