mirror of
				https://github.com/monkeytypegame/monkeytype.git
				synced 2025-11-01 03:39:15 +08:00 
			
		
		
		
	* Migrate middlewares * Update workflow * Fix ignore * Fix * Fix * Remove babel loader from root dependencies * Remove mongoDb
		
			
				
	
	
		
			27 lines
		
	
	
	
		
			599 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			27 lines
		
	
	
	
		
			599 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| import cors from "cors";
 | |
| import helmet from "helmet";
 | |
| import addApiRoutes from "./api/routes";
 | |
| import express, { urlencoded, json } from "express";
 | |
| import contextMiddleware from "./middlewares/context";
 | |
| import errorHandlingMiddleware from "./middlewares/error";
 | |
| 
 | |
| function buildApp(): express.Application {
 | |
|   const app = express();
 | |
| 
 | |
|   app.use(urlencoded({ extended: true }));
 | |
|   app.use(json());
 | |
|   app.use(cors());
 | |
|   app.use(helmet());
 | |
| 
 | |
|   app.set("trust proxy", 1);
 | |
| 
 | |
|   app.use(contextMiddleware);
 | |
| 
 | |
|   addApiRoutes(app);
 | |
| 
 | |
|   app.use(errorHandlingMiddleware);
 | |
| 
 | |
|   return app;
 | |
| }
 | |
| 
 | |
| export default buildApp();
 |