mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 12:09:51 +02:00
feat: added route suffix to routes
This commit is contained in:
1 parent
423a8b8088
commit
433ffba1e3
2 files changed
+4
-4
No files matched your search
@@ -3,7 +3,7 @@ import resolvePlayerFromRequest from '../core/express/resolvePlayerFromRequest.j
|
|||||||
import stats, { StatType } from '../renderers/stats.js';
|
import stats, { StatType } from '../renderers/stats.js';
|
||||||
import { RouteRegistry } from '../server.js';
|
import { RouteRegistry } from '../server.js';
|
||||||
|
|
||||||
export default {
|
export const statsRoute: RouteRegistry = {
|
||||||
route: '/stats/:type/:period',
|
route: '/stats/:type/:period',
|
||||||
inProduction: true,
|
inProduction: true,
|
||||||
inDevelopment: false,
|
inDevelopment: false,
|
||||||
@@ -21,4 +21,4 @@ export default {
|
|||||||
true,
|
true,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
} satisfies RouteRegistry;
|
};
|
||||||
+2
-2
@@ -3,7 +3,7 @@ import normalizeRouteReturnable from './core/express/normalizeRouteReturnable.js
|
|||||||
import withAutoRefresh from './core/express/withAutoRefresh.js';
|
import withAutoRefresh from './core/express/withAutoRefresh.js';
|
||||||
import isDev from './core/node/isDev.js';
|
import isDev from './core/node/isDev.js';
|
||||||
import { Registry } from './events/interactionCreate/index.js';
|
import { Registry } from './events/interactionCreate/index.js';
|
||||||
import stats from './routes/stats.js';
|
import { statsRoute } from './routes/stats.js';
|
||||||
|
|
||||||
export type RouteReturnable = JSX.Element | Promise<JSX.Element>;
|
export type RouteReturnable = JSX.Element | Promise<JSX.Element>;
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@ export interface RouteRegistry<HandlesInteraction extends boolean = false>
|
|||||||
|
|
||||||
const app = express();
|
const app = express();
|
||||||
|
|
||||||
([stats] as RouteRegistry[]).forEach((registry) => {
|
([statsRoute] as RouteRegistry[]).forEach((registry) => {
|
||||||
if (!(isDev() ? registry.inDevelopment : registry.inProduction)) return;
|
if (!(isDev() ? registry.inDevelopment : registry.inProduction)) return;
|
||||||
|
|
||||||
app.get(registry.route, async (req, res) => {
|
app.get(registry.route, async (req, res) => {
|
||||||
|
|||||||
Reference in new issue
Block a user