Compare commits
No commits in common. "d1d8311b9da5e638f3bda730c1b309257b470379" and "902f2812f0b3eb17413d050f1afcb9b5fb373150" have entirely different histories.
d1d8311b9d
...
902f2812f0
13
basics.js
13
basics.js
@ -1,7 +1,6 @@
|
||||
const fs = require("fs")
|
||||
const path = require("path")
|
||||
|
||||
var metricsPathFile = metricsPathFile
|
||||
|
||||
module.exports.getDate = function (formated) {
|
||||
|
||||
@ -46,20 +45,16 @@ module.exports.getDate = function (formated) {
|
||||
|
||||
}
|
||||
|
||||
module.exports.setMetricsFile = (path) => {
|
||||
metricsPathFile = path
|
||||
}
|
||||
|
||||
|
||||
module.exports.getMetricsFile = () => {
|
||||
if(!fs.existsSync()) {
|
||||
fs.writeFileSync(metricsPathFile, JSON.stringify([], null, 2))
|
||||
if(!fs.existsSync(path.join(__dirname, "/metrics.json"))) {
|
||||
fs.writeFileSync(path.join(__dirname, "/metrics.json"), JSON.stringify([], null, 2))
|
||||
} else {
|
||||
return JSON.parse(fs.readFileSync(metricsPathFile))
|
||||
return JSON.parse(fs.readFileSync(path.join(__dirname, "/metrics.json")))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports.saveMetricsFile = (data) => {
|
||||
fs.writeFileSync(metricsPathFile, JSON.stringify(data, null, 2))
|
||||
fs.writeFileSync(path.join(__dirname, "/metrics.json"), JSON.stringify(data, null, 2))
|
||||
}
|
6
main.js
6
main.js
@ -5,12 +5,6 @@
|
||||
const basics = require('./basics.js');
|
||||
const fs = require('fs');
|
||||
|
||||
module.exports.setMetricFile = (path) => {
|
||||
basics.setMetricsFile(path);
|
||||
const metricsFile = basics.getMetricsFile();
|
||||
}
|
||||
|
||||
|
||||
module.exports.Metric = class {
|
||||
name;
|
||||
description;
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "webmetrik",
|
||||
"version": "0.1.3",
|
||||
"version": "0.1.0",
|
||||
"description": "NodeJS - npm package - Make metrics and make it available by making a httpServer",
|
||||
"main": "main.js",
|
||||
"keywords": [],
|
||||
|
Loading…
Reference in New Issue
Block a user