38 lines
1.4 KiB
JavaScript
38 lines
1.4 KiB
JavaScript
const FunctionModules = require('./modules/index');
|
|
const FunctionModules2 = require('./modules2/index');
|
|
const express = require('express');
|
|
const cors = require('cors');
|
|
|
|
// VERSION 1
|
|
const app = express();
|
|
app.use(cors({ origin: true }));
|
|
app.use(FunctionModules.authenticator);
|
|
app.get('/validator', 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);
|
|
|
|
// 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,
|
|
};
|