Skip to content

Commit 741c3d5

Browse files
committed
Enabled CORS
1 parent 080287d commit 741c3d5

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

app/app.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
import * as express from 'express'
22
import { AppRoutes } from './routes';
33
import bodyParser = require('body-parser');
4+
import * as cors from 'cors';
45

56
class App {
67
public express : express.Application;
78

89
constructor () {
910
this.express = express();
10-
this.mountRoutes();
11-
11+
this.mountRoutes();
1212
}
1313

1414
private mountRoutes (): void {
15+
this.express.use(cors())
1516
this.express.use(bodyParser.json());
1617
this.express.use(new AppRoutes().routes);
1718
}

package-lock.json

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"@types/express": "^4.17.6",
2828
"body-parser": "^1.19.0",
2929
"cluster": "^0.7.7",
30+
"cors": "^2.8.5",
3031
"express": "^4.17.1",
3132
"express-async-handler": "^1.1.4",
3233
"mongoose": "^5.9.21",

0 commit comments

Comments
 (0)