-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.ts
27 lines (19 loc) · 752 Bytes
/
app.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Import config to setup the global configuration object.
import { config } from "./config";
import express from "express";
const app = express();
/** Setup request body parsing */
import bodyParser from "body-parser";
app.use(bodyParser.json());
/** Import routers from ``app/routes/index`` **/
import indexRouter from "./app/routes/index";
/** Configure application to use routers **/
app.use("/", indexRouter);
/** Global Middleware Example */
import ExampleMiddleware from "./app/http/middleware/ExampleMiddleware";
/** Using the middleware on all routes */
app.use(ExampleMiddleware);
/** Using a custom error handler */
import ExceptionHandler from "./app/exceptions/ExceptionHandler";
app.use(ExceptionHandler);
export { app, config };