Move in progress apps temporarily
This commit is contained in:
parent
ba04aa108c
commit
6eaaf8e9be
360 changed files with 6171 additions and 55 deletions
|
|
@ -1,33 +0,0 @@
|
|||
import isFunction from "lodash/isFunction";
|
||||
import type * as Hapi from "@hapi/hapi";
|
||||
import * as RandomRoutes from "./random";
|
||||
import * as UserRoutes from "./users";
|
||||
import * as VoiceRoutes from "./voice";
|
||||
import * as WhatsappRoutes from "./whatsapp";
|
||||
import * as SignalRoutes from "./signal";
|
||||
|
||||
const loadRouteIndex = async (server, index) => {
|
||||
const routes = [];
|
||||
for (const exported in index) {
|
||||
if (Object.prototype.hasOwnProperty.call(index, exported)) {
|
||||
const route = index[exported];
|
||||
routes.push(route);
|
||||
}
|
||||
}
|
||||
|
||||
routes.forEach(async (route) => {
|
||||
if (isFunction(route)) server.route(await route(server));
|
||||
else server.route(route);
|
||||
});
|
||||
};
|
||||
|
||||
export const register = async (server: Hapi.Server): Promise<void> => {
|
||||
// Load your routes here.
|
||||
// routes are loaded from the list of exported vars
|
||||
// a route file should export routes directly or an async function that returns the routes.
|
||||
loadRouteIndex(server, RandomRoutes);
|
||||
loadRouteIndex(server, UserRoutes);
|
||||
loadRouteIndex(server, VoiceRoutes);
|
||||
loadRouteIndex(server, WhatsappRoutes);
|
||||
loadRouteIndex(server, SignalRoutes);
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue