Move stats to utils.js
All checks were successful
/ node-check (pull_request) Successful in 3s
/ prettier (pull_request) Successful in 27s
/ boot (pull_request) Successful in 26s
/ tests (pull_request) Successful in 37s
/ tests (push) Successful in 20s
/ prettier (push) Successful in 5s
/ node-check (push) Successful in 3s
/ boot (push) Successful in 3s
All checks were successful
/ node-check (pull_request) Successful in 3s
/ prettier (pull_request) Successful in 27s
/ boot (pull_request) Successful in 26s
/ tests (pull_request) Successful in 37s
/ tests (push) Successful in 20s
/ prettier (push) Successful in 5s
/ node-check (push) Successful in 3s
/ boot (push) Successful in 3s
This commit is contained in:
parent
6edff2c74e
commit
06f52fc2b4
2 changed files with 7 additions and 6 deletions
6
index.js
6
index.js
|
@ -9,12 +9,6 @@ import {
|
|||
counter_set,
|
||||
} from "./utils.js";
|
||||
const app = express();
|
||||
var stats = {
|
||||
keys_created: 0,
|
||||
keys_updated: 0,
|
||||
requests: 0,
|
||||
version: "who knows?",
|
||||
};
|
||||
app.use((req, res, next) => {
|
||||
stats.requests++;
|
||||
return next();
|
||||
|
|
7
utils.js
7
utils.js
|
@ -1,6 +1,13 @@
|
|||
import sql from "./db.js";
|
||||
const valid_regex = /^[A-Za-z0-9_\-\.]{3,64}$/;
|
||||
var namespace_id_cache = {};
|
||||
/* TODO: put stats into its own file */
|
||||
export var stats = {
|
||||
keys_created: 0,
|
||||
keys_updated: 0,
|
||||
requests: 0,
|
||||
version: "who knows?",
|
||||
};
|
||||
|
||||
export async function get_namespace_id(name, create = true) {
|
||||
return await sql.begin(async (sql) => {
|
||||
|
|
Loading…
Reference in a new issue