2022-05-31 13:57:15 +00:00
|
|
|
import Express, {
|
|
|
|
ExpressApplication,
|
2022-03-21 22:26:54 +00:00
|
|
|
ExpressRequest,
|
|
|
|
ExpressResponse,
|
2022-03-22 11:19:12 +00:00
|
|
|
ExpressStatic,
|
2022-04-10 21:57:14 +00:00
|
|
|
} from 'CommonServer/Utils/Express';
|
2022-04-01 20:17:29 +00:00
|
|
|
|
2022-02-27 12:24:02 +00:00
|
|
|
import path from 'path';
|
2020-12-21 06:06:39 +00:00
|
|
|
|
2022-05-31 13:57:15 +00:00
|
|
|
const app: ExpressApplication = Express.getExpressApp();
|
|
|
|
|
2022-04-15 22:14:01 +00:00
|
|
|
// Set the view engine to ejs
|
2020-01-16 20:30:32 +00:00
|
|
|
app.set('views', path.join(__dirname, 'views'));
|
|
|
|
app.set('view engine', 'ejs');
|
2019-08-02 12:56:16 +00:00
|
|
|
|
2022-04-15 22:14:01 +00:00
|
|
|
// Public static files
|
2022-03-22 11:19:12 +00:00
|
|
|
app.use(ExpressStatic(path.join(__dirname, 'public'), { maxAge: 2592000 }));
|
2020-01-16 20:30:32 +00:00
|
|
|
|
2020-03-22 14:22:56 +00:00
|
|
|
app.use(
|
|
|
|
'/docs',
|
2022-03-22 11:19:12 +00:00
|
|
|
ExpressStatic(path.join(__dirname, 'public'), { maxAge: 2592000 })
|
2020-03-22 14:22:56 +00:00
|
|
|
);
|
2020-03-22 09:27:39 +00:00
|
|
|
|
2022-04-15 22:14:01 +00:00
|
|
|
// Index page
|
2022-04-02 11:35:36 +00:00
|
|
|
app.get(['/', '/docs'], (_req: ExpressRequest, res: ExpressResponse) => {
|
2020-01-16 20:30:32 +00:00
|
|
|
res.render('pages/index');
|
2019-08-02 12:56:16 +00:00
|
|
|
});
|
|
|
|
|
2022-02-25 13:22:20 +00:00
|
|
|
export default app;
|