forked from Turing-DECO3801/hiking-memory-backend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.ts
35 lines (29 loc) · 958 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
28
29
30
31
32
33
34
35
import express from 'express';
import bodyParser from 'body-parser';
import { cors } from './src/middleware/cors';
import routes from './src/routes';
import { setUpDatabase } from './src/services/database';
import { setUpS3 } from './src/services/s3';
import { setEmailHeader } from './src/middleware/setEmailHeader';
import { logRequest } from './src/middleware/logRequest';
const configure = async () => {
// Express
const app = express();
// Middlewares
app.use(bodyParser.json({ limit: '50mb' }));
app.use(bodyParser.urlencoded({ limit: '50mb', extended: true, parameterLimit:50000 }));
app.use(express.json());
app.use(logRequest);
app.use(cors);
app.use(setEmailHeader);
app.use('/', routes);
// Database
await setUpDatabase();
// S3
await setUpS3();
// Start
app.listen(process.env.PORT, () => {
console.log(`Listening on port ${process.env.PORT}`);
});
}
configure();