QPS Stats
This commit is contained in:
7
pages/api/stats.js
Normal file
7
pages/api/stats.js
Normal file
@@ -0,0 +1,7 @@
|
||||
import { stats, addAPIQPS } from "../../libs/stats";
|
||||
|
||||
export default function handler(req, res) {
|
||||
addAPIQPS();
|
||||
res.setHeader("Cache-Control", "no-cache no-store must-revalidate");
|
||||
res.status(200).json(stats);
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
import { authenticate, setLimit, getLimit } from "../../../libs/db";
|
||||
import { addAPIQPS } from "../../../libs/stats";
|
||||
|
||||
export default function handler(req, res) {
|
||||
addAPIQPS();
|
||||
// put method
|
||||
if (req.method === "PUT") {
|
||||
const { token, limit } = req.body;
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import { authenticate, getTimeRanges, insertTimeRange } from "../../../libs/db";
|
||||
|
||||
import { addAPIQPS } from "../../../libs/stats";
|
||||
|
||||
export default function handler(req, res) {
|
||||
addAPIQPS();
|
||||
// get method
|
||||
if (req.method === "GET") {
|
||||
res.setHeader("Cache-Control", "no-cache no-store must-revalidate");
|
||||
|
||||
@@ -5,7 +5,10 @@ import {
|
||||
updateUsernameWithLimit,
|
||||
} from "../../../../libs/db";
|
||||
|
||||
import { addAPIQPS } from '../../../../libs/stats';
|
||||
|
||||
export default function handler(req, res) {
|
||||
addAPIQPS();
|
||||
// check if id is valid
|
||||
const { id } = req.query;
|
||||
if (id === undefined) {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { authenticate, getStarted, setStarted } from "../../../libs/db";
|
||||
import { addAPIQPS } from "../../../libs/stats";
|
||||
|
||||
export default function handler(req, res) {
|
||||
addAPIQPS();
|
||||
// get method
|
||||
if (req.method === "GET") {
|
||||
res.setHeader("Cache-Control", "no-cache no-store must-revalidate");
|
||||
|
||||
Reference in New Issue
Block a user