39 lines
835 B
TypeScript
39 lines
835 B
TypeScript
import * as path from 'path';
|
|
|
|
import bodyParser from 'body-parser';
|
|
import cors from 'cors';
|
|
import express from 'express';
|
|
import audit from 'express-requests-logger';
|
|
|
|
import apiRouter from './src/api';
|
|
|
|
const app = express();
|
|
const port = 5000;
|
|
|
|
app.use(audit({
|
|
excludeURLs: ['images'],
|
|
request: {
|
|
excludeHeaders: ['*'],
|
|
maxBodyLength: 100,
|
|
},
|
|
response: {
|
|
excludeBody: ['*'],
|
|
excludeHeaders: ['*'],
|
|
maxBodyLength: 50,
|
|
},
|
|
}));
|
|
app.use(cors());
|
|
app.use('/static', express.static(path.join(__dirname, 'static')));
|
|
|
|
app.use(bodyParser.raw({ type: 'application/soap+xml' }));
|
|
app.use(bodyParser.json({ limit: '20mb' }));
|
|
|
|
app.use(express.json());
|
|
|
|
app.use('/api', apiRouter);
|
|
|
|
app.listen(port, () => {
|
|
// eslint-disable-next-line no-console
|
|
console.log(`Arkids backend app start on port ${port}`);
|
|
});
|