2024-09-07 18:12:58 -04:00
|
|
|
import main from "./client/main.js";
|
|
|
|
import auth from "./form/auth.js";
|
|
|
|
import login from "./client/login.js";
|
|
|
|
import register from "./client/register.js";
|
2024-09-19 05:44:24 -04:00
|
|
|
import upload from "./client/upload.js";
|
|
|
|
import player from "./client/player.js";
|
2024-09-07 18:12:58 -04:00
|
|
|
import loginB from "./form/login.js";
|
|
|
|
import registerB from "./form/register.js";
|
2024-09-19 05:44:24 -04:00
|
|
|
import uploadB from "./form/upload.js";
|
2024-09-07 18:12:58 -04:00
|
|
|
|
|
|
|
const routes = {
|
|
|
|
get: {},
|
|
|
|
form: {},
|
2024-09-19 05:44:24 -04:00
|
|
|
client: {},
|
2024-09-07 18:12:58 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
routes.client = {
|
|
|
|
main,
|
|
|
|
login,
|
2024-09-19 05:44:24 -04:00
|
|
|
register,
|
|
|
|
upload,
|
|
|
|
video: player
|
2024-09-07 18:12:58 -04:00
|
|
|
}
|
|
|
|
routes.get = {
|
|
|
|
};
|
|
|
|
routes.form = {
|
|
|
|
login: loginB,
|
|
|
|
register: registerB,
|
2024-09-19 05:44:24 -04:00
|
|
|
upload: uploadB,
|
2024-09-07 18:12:58 -04:00
|
|
|
auth
|
|
|
|
};
|
|
|
|
|
|
|
|
async function iterate(req, res, index) {
|
|
|
|
let routesI = routes[index];
|
|
|
|
let keys = Object.keys(routesI);
|
|
|
|
|
|
|
|
let cmd = req.params.route;
|
2024-09-19 05:04:03 -04:00
|
|
|
if (keys.indexOf(cmd) == -1) {
|
|
|
|
res.status(404).send('fail');
|
|
|
|
return;
|
|
|
|
}
|
2024-09-07 18:12:58 -04:00
|
|
|
|
|
|
|
return await routesI[cmd].run(req, res, {});
|
|
|
|
}
|
|
|
|
|
|
|
|
export default iterate;
|