const FunctionModules = require('./modules/index'); const FunctionModules2 = require('./modules2/index'); const Webhooks = require('./webhooks/index'); const express = require('express'); const cors = require('cors'); // WEBHOOKS const webhooks = express(); webhooks.use(cors({ origin: true })); webhooks.all('/conferenceEnded', Webhooks.conferenceEnd); webhooks.all('/scheduledCleanup', Webhooks.scheduledCleanUp); webhooks.all('/ask', Webhooks.ask); // VERSION 1 const app = express(); app.use(cors({ origin: true })); app.use(FunctionModules.authenticator); app.get('/validator/:partyName', FunctionModules.tokenValidator); app.get('/refresher/:token', FunctionModules.tokenRefresher); app.post('/create', FunctionModules.createRoom); app.post('/join', FunctionModules.joinRoom); app.post('/message', FunctionModules.sendMessage); app.post('/updatePlayer', FunctionModules.updatePlayer); app.post('/updateVoxeet', FunctionModules.updateVoxeet); app.delete('/leave/:rid/users/:uid', FunctionModules.leaveRoom); app.delete('/delete/:rid', FunctionModules.deleteRoom); app.put('/updateAdminOnly/:rid/:adminOnly', FunctionModules.updateAdminOnly); // VERSION 2 const app2 = express(); app2.use(cors({ origin: true })); app2.use(FunctionModules2.authenticator); app2.get('/validator', FunctionModules2.tokenValidator); app2.get('/refresher/:token', FunctionModules2.tokenRefresher); app2.post('/create', FunctionModules2.createRoom); app2.post('/join', FunctionModules2.joinRoom); app2.post('/message', FunctionModules2.sendMessage); app2.post('/updatePlayer', FunctionModules2.updatePlayer); app2.post('/updateVoxeet', FunctionModules2.updateVoxeet); app2.delete('/leave/:rid/users/:uid', FunctionModules2.leaveRoom); app2.delete('/delete/:rid', FunctionModules2.deleteRoom); module.exports = { v1: app, v2: app2, webhooks, };