basic loaders logic
This commit is contained in:
		@@ -4,6 +4,8 @@ import consola from 'consola';
 | 
				
			|||||||
import * as jwt from 'jsonwebtoken';
 | 
					import * as jwt from 'jsonwebtoken';
 | 
				
			||||||
import { createConnection } from 'typeorm';
 | 
					import { createConnection } from 'typeorm';
 | 
				
			||||||
import 'reflect-metadata';
 | 
					import 'reflect-metadata';
 | 
				
			||||||
 | 
					// const loaders = require('./loaders');
 | 
				
			||||||
 | 
					import * as loaders from './loaders/index';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
dotenvSafe.config();
 | 
					dotenvSafe.config();
 | 
				
			||||||
const app = express();
 | 
					const app = express();
 | 
				
			||||||
@@ -20,6 +22,7 @@ createConnection()
 | 
				
			|||||||
			consola.info(encoded);
 | 
								consola.info(encoded);
 | 
				
			||||||
			return res.send('Express + TypeScript Server');
 | 
								return res.send('Express + TypeScript Server');
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
 | 
							// await loaders.init(app);
 | 
				
			||||||
		app.listen(PORT, () => {
 | 
							app.listen(PORT, () => {
 | 
				
			||||||
			consola.success(`⚡️[server]: Server is running at http://localhost:${PORT}`);
 | 
								consola.success(`⚡️[server]: Server is running at http://localhost:${PORT}`);
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										0
									
								
								src/loaders/.gitkeep
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								src/loaders/.gitkeep
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										14
									
								
								src/loaders/index.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								src/loaders/index.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,14 @@
 | 
				
			|||||||
 | 
					import express from 'express';
 | 
				
			||||||
 | 
					import bodyParser from 'body-parser';
 | 
				
			||||||
 | 
					import cors from 'cors';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export default async (app) => {
 | 
				
			||||||
 | 
						app.get('/status', (req, res) => res.status(200).end());
 | 
				
			||||||
 | 
						app.enable('trust proxy');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						app.use(cors());
 | 
				
			||||||
 | 
						// app.use(bodyParser.urlencoded({ extended: false }));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// more middlewares
 | 
				
			||||||
 | 
						return app;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
		Reference in New Issue
	
	Block a user