-
-
Save morintd/a515410c627067ba659f74084fad9554 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Request, Response } from "express"; | |
import cookieParser from "cookie-parser"; | |
import express from "express"; | |
import { TicTacToeController } from "../tic-tac-toe/tic-tac-toe.controller"; | |
import { TicTacToeModule } from "../tic-tac-toe/tic-tac-toe.module"; | |
import { BoardService } from "../tic-tac-toe/board.repository"; | |
function createApp() { | |
const app = express(); | |
app.use(express.json()); | |
app.use(express.urlencoded({ extended: false })); | |
app.use(cookieParser()); | |
const service = new BoardService(); | |
const module = new TicTacToeModule(new TicTacToeController(service)); | |
module.configure(app); | |
// eslint-disable-next-line @typescript-eslint/no-explicit-any | |
app.use((error: any, _req: Request, res: Response) => { | |
console.log({ error, _req, res }); | |
return res.status(error.status || 500).json(error.body); | |
}); | |
return app; | |
} | |
export default createApp; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment