Skip to content

Commit

Permalink
Merge pull request #300 from labzero/develop
Browse files Browse the repository at this point in the history
Merge to master
  • Loading branch information
JeffreyATW authored May 5, 2023
2 parents f200b8e + bc74409 commit c4b2bf6
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
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

0 comments on commit c4b2bf6

Please sign in to comment.