import main from "./client/main.js"; import login from "./client/login.js"; import register from "./client/register.js"; import upload from "./client/upload.js"; import player from "./client/player.js"; import user from "./client/user.js"; import loginB from "./form/login.js"; import registerB from "./form/register.js"; import uploadB from "./form/upload.js"; import auth from "./form/auth.js"; import commentB from "./form/comment.js"; import follow from './form/follow.js'; const routes = { get: {}, form: {}, client: {}, }; routes.client = { main, login, register, upload, video: player, user } routes.get = { }; routes.form = { login: loginB, register: registerB, upload: uploadB, auth, comment: commentB, follow }; async function iterate(req, res, index) { let routesI = routes[index]; let keys = Object.keys(routesI); let cmd = req.params.route; if (keys.indexOf(cmd) == -1) { res.status(404).send('fail'); return; } return await routesI[cmd].run(req, res, {}); } export default iterate;