|
|
@ -2,21 +2,20 @@ import * as compression from "compression";
|
|
|
|
import * as config from "config";
|
|
|
|
import * as config from "config";
|
|
|
|
import * as cookieParser from "cookie-parser";
|
|
|
|
import * as cookieParser from "cookie-parser";
|
|
|
|
import * as cors from "cors";
|
|
|
|
import * as cors from "cors";
|
|
|
|
import {Request, Response} from "express";
|
|
|
|
|
|
|
|
import * as express from "express";
|
|
|
|
import * as express from "express";
|
|
|
|
|
|
|
|
import {Request, Response} from "express";
|
|
|
|
import * as graphqlHTTP from "express-graphql";
|
|
|
|
import * as graphqlHTTP from "express-graphql";
|
|
|
|
import * as session from "express-session";
|
|
|
|
import * as session from "express-session";
|
|
|
|
import sharedsession = require("express-socket.io-session");
|
|
|
|
|
|
|
|
import * as fsx from "fs-extra";
|
|
|
|
import * as fsx from "fs-extra";
|
|
|
|
import {buildSchema} from "graphql";
|
|
|
|
import {buildSchema} from "graphql";
|
|
|
|
import {importSchema} from "graphql-import";
|
|
|
|
import {importSchema} from "graphql-import";
|
|
|
|
import queryComplexity, {directiveEstimator, simpleEstimator} from "graphql-query-complexity";
|
|
|
|
import queryComplexity, {directiveEstimator, simpleEstimator} from "graphql-query-complexity";
|
|
|
|
import {IncomingMessage, ServerResponse} from "http";
|
|
|
|
|
|
|
|
import * as http from "http";
|
|
|
|
import * as http from "http";
|
|
|
|
|
|
|
|
import {IncomingMessage} from "http";
|
|
|
|
import * as httpStatus from "http-status";
|
|
|
|
import * as httpStatus from "http-status";
|
|
|
|
import * as path from "path";
|
|
|
|
import * as path from "path";
|
|
|
|
import {RedisClient} from "redis";
|
|
|
|
|
|
|
|
import * as redis from "redis";
|
|
|
|
import * as redis from "redis";
|
|
|
|
|
|
|
|
import {RedisClient} from "redis";
|
|
|
|
import {Sequelize} from "sequelize-typescript";
|
|
|
|
import {Sequelize} from "sequelize-typescript";
|
|
|
|
import * as socketIo from "socket.io";
|
|
|
|
import * as socketIo from "socket.io";
|
|
|
|
import * as socketIoRedis from "socket.io-redis";
|
|
|
|
import * as socketIoRedis from "socket.io-redis";
|
|
|
@ -25,6 +24,7 @@ import dataaccess from "./lib/dataAccess";
|
|
|
|
import globals from "./lib/globals";
|
|
|
|
import globals from "./lib/globals";
|
|
|
|
import HomeRoute from "./routes/HomeRoute";
|
|
|
|
import HomeRoute from "./routes/HomeRoute";
|
|
|
|
import {UploadRoute} from "./routes/UploadRoute";
|
|
|
|
import {UploadRoute} from "./routes/UploadRoute";
|
|
|
|
|
|
|
|
import sharedsession = require("express-socket.io-session");
|
|
|
|
|
|
|
|
|
|
|
|
const SequelizeStore = require("connect-session-sequelize")(session.Store);
|
|
|
|
const SequelizeStore = require("connect-session-sequelize")(session.Store);
|
|
|
|
const createLimiter: (...args: any) => any = require("express-limiter");
|
|
|
|
const createLimiter: (...args: any) => any = require("express-limiter");
|
|
|
@ -107,7 +107,7 @@ class App {
|
|
|
|
store: new SequelizeStore({db: this.sequelize}),
|
|
|
|
store: new SequelizeStore({db: this.sequelize}),
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
await this.sequelize.sync({ logging: (msg) => logger.silly(msg)});
|
|
|
|
await this.sequelize.sync({logging: (msg) => logger.silly(msg)});
|
|
|
|
this.sequelize.options.logging = (msg) => logger.silly(msg);
|
|
|
|
this.sequelize.options.logging = (msg) => logger.silly(msg);
|
|
|
|
logger.info("Setting up socket.io");
|
|
|
|
logger.info("Setting up socket.io");
|
|
|
|
try {
|
|
|
|
try {
|
|
|
@ -224,7 +224,7 @@ class App {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
// redirect all request to the angular file
|
|
|
|
// redirect all request to the angular file
|
|
|
|
this.app.use((req: any, res: Response) => {
|
|
|
|
this.app.use((req: any, res: Response) => {
|
|
|
|
if (config.get("frontend.angularIndex")) {
|
|
|
|
if (config.has("frontend.angularIndex")) {
|
|
|
|
const angularIndex = path.join(this.publicPath, config.get("frontend.angularIndex"));
|
|
|
|
const angularIndex = path.join(this.publicPath, config.get("frontend.angularIndex"));
|
|
|
|
if (fsx.existsSync(path.join(angularIndex))) {
|
|
|
|
if (fsx.existsSync(path.join(angularIndex))) {
|
|
|
|
res.sendFile(angularIndex);
|
|
|
|
res.sendFile(angularIndex);
|
|
|
|