import main from "./client/main.js"; import auth from "./form/auth.js"; import login from "./client/login.js"; import register from "./client/register.js"; import loginB from "./form/login.js"; import registerB from "./form/register.js"; const routes = { get: {}, form: {}, client: {} }; routes.client = { main, login, register } routes.get = { }; routes.form = { login: loginB, register: registerB, auth }; 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) return '404 not found'; return await routesI[cmd].run(req, res, {}); } export default iterate;