Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge to master #300

Merged
merged 3 commits into from
May 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"dotenv": "^2.0.0",
"eventemitter3": "^1.2.0",
"express": "^4.17.3",
"express-body-parser-error-handler": "^1.0.4",
"express-jwt": "^8.4.1",
"express-session": "^1.17.3",
"express-sslify": "^1.2.0",
Expand Down Expand Up @@ -259,4 +260,4 @@
"start": "babel-node tools/run start",
"prepare": "husky install"
}
}
}
8 changes: 6 additions & 2 deletions src/server.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@ import path from 'path';
import fs from 'fs';
import { createStream } from 'rotating-file-stream';
import morgan from 'morgan';
import express, { ErrorRequestHandler, NextFunction, Request, RequestHandler, Response } from 'express';
import express, { ErrorRequestHandler, RequestHandler } from 'express';
import cors from 'cors';
import http from 'http';
import https from 'https';
import enforce from 'express-sslify';
import compression from 'compression';
import cookieParser from 'cookie-parser';
import bodyParser from 'body-parser';
import bodyParserErrorHandler from 'express-body-parser-error-handler';
import methodOverride from 'method-override';
import session from 'express-session';
import connectSessionSequelize from 'connect-session-sequelize';
Expand All @@ -32,6 +33,7 @@ import expressWs from 'express-ws';
import Honeybadger from '@honeybadger-io/js';
import PrettyError from 'pretty-error';
import { v1 } from 'uuid';
import { ResolveContext } from 'universal-router';
import App from './components/App';
import Html from './components/Html';
import { ErrorPageWithoutStyle } from './components/ErrorPage/ErrorPage';
Expand All @@ -57,7 +59,6 @@ import { sequelize } from './models/db';
import { Team, User } from './models';
import { Flash, StateData } from './interfaces';
import { ExtWebSocket, Style } from '../global';
import { ResolveContext } from 'universal-router';

process.on('unhandledRejection', (reason, p) => {
console.error('Unhandled Rejection at:', p, 'reason:', reason);
Expand Down Expand Up @@ -138,6 +139,9 @@ app.use(express.static(path.resolve(__dirname, 'public')));
app.use(cookieParser());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());

app.use(bodyParserErrorHandler());

app.use(
methodOverride((req) => {
if (req.body && typeof req.body === 'object' && '_method' in req.body) {
Expand Down
2 changes: 2 additions & 0 deletions types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ declare module "*.scss" {
}

declare module 'react-deep-force-update';

declare module 'express-body-parser-error-handler';
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5563,6 +5563,11 @@ executable@^4.1.1:
dependencies:
pify "^2.2.0"

express-body-parser-error-handler@^1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/express-body-parser-error-handler/-/express-body-parser-error-handler-1.0.4.tgz#ab948ca4e1525a0e0f9ae501a1ae9bf6752f2729"
integrity sha512-RUpblgIt9PU7y7gfdCrXnXJQ+XD8msEoLFSAKO1qoFZDPlwh44tc7/+GWx9gQFuLeWy6hzz7jq+YCXvWL8FdYg==

express-jwt@^8.4.1:
version "8.4.1"
resolved "https://registry.yarnpkg.com/express-jwt/-/express-jwt-8.4.1.tgz#ba817c1ced7c6f1f7017fc2e6deac207011e8acb"
Expand Down