mirror of
https://github.com/captbaritone/webamp.git
synced 2026-01-23 02:15:01 +00:00
Fix tests
Summary: Test Plan:
This commit is contained in:
parent
3904636e8a
commit
5a3b08e621
2 changed files with 8 additions and 3 deletions
|
|
@ -3,7 +3,7 @@ import cors, { CorsOptions } from "cors";
|
|||
import Sentry from "@sentry/node";
|
||||
import expressSitemapXml from "express-sitemap-xml";
|
||||
import * as Skins from "../data/skins";
|
||||
import express, { RequestHandler, ErrorRequestHandler } from "express";
|
||||
import express, { RequestHandler, ErrorRequestHandler, Handler } from "express";
|
||||
import UserContext from "../data/UserContext";
|
||||
import cookieSession from "cookie-session";
|
||||
import { SECRET } from "../config";
|
||||
|
|
@ -59,10 +59,11 @@ declare global {
|
|||
|
||||
type Options = {
|
||||
eventHandler?: EventHandler;
|
||||
extraMiddleware?: Handler;
|
||||
logger?: Logger;
|
||||
};
|
||||
|
||||
export function createApp({ eventHandler, logger }: Options) {
|
||||
export function createApp({ eventHandler, logger, extraMiddleware }: Options) {
|
||||
const app = express();
|
||||
if (Sentry) {
|
||||
app.use(Sentry.Handlers.requestHandler() as RequestHandler);
|
||||
|
|
@ -90,6 +91,10 @@ export function createApp({ eventHandler, logger }: Options) {
|
|||
|
||||
app.use(cookieHandler);
|
||||
|
||||
if (extraMiddleware != null) {
|
||||
app.use(extraMiddleware);
|
||||
}
|
||||
|
||||
// Add UserContext to request
|
||||
app.use((req, res, next) => {
|
||||
req.ctx = new UserContext(req.session.username);
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ const production = {
|
|||
migrations: {
|
||||
tableName: "knex_migrations",
|
||||
// Use process.cwd() and not __dir since Next runs from a build directory
|
||||
directory: path.join(process.cwd(), "./migrations"),
|
||||
directory: path.join(__dirname, "./migrations"),
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue