-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathserver.ts
39 lines (31 loc) · 924 Bytes
/
server.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
36
37
38
39
import express from 'express';
import bodyParser from 'body-parser';
import knex from './src/knex';
import objection from './src/objection';
import sequelize from './src/sequelize';
import { initializeTypeOrm } from './src/typeorm'
const DEFAULT_BODY_SIZE_LIMIT = 1024 * 1024 * 10;
const DEFAULT_PARAMETER_LIMIT = 10000;
const PORT = 8080;
const app = express();
// Client must send "Content-Type: application/json" header
app.use(bodyParser.json({
limit: DEFAULT_BODY_SIZE_LIMIT
}));
app.use(bodyParser.urlencoded({
extended: true,
parameterLimit: DEFAULT_PARAMETER_LIMIT
}));
app.use('/sequelize', sequelize);
app.use('/objection', objection);
app.use('/knex', knex);
Promise.resolve()
.then(() => initializeTypeOrm())
.then(typeOrmRouter => {
app.use('/typeorm', typeOrmRouter);
})
.then(() => {
app.listen(PORT);
console.log(`Listening on port: ${PORT}`);
})
.catch(console.error);