Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions build/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
var serviceManager_1 = __importDefault(require("./serviceManager"));
var express_1 = __importDefault(require("express"));
var body_parser_1 = __importDefault(require("body-parser"));
var cors_1 = __importDefault(require("cors"));
var app = express_1.default();
var HOST = "127.0.0.1";
var PORTFORSERVICES = 9999; // @todo Change by configurable port
var serviceManager = new serviceManager_1.default(PORTFORSERVICES, HOST);
app.use(cors_1.default());
app.use(body_parser_1.default.json()); // to support JSON-encoded bodies
app.use(body_parser_1.default.urlencoded({
extended: true,
}));
app.options("*", cors_1.default({
origin: "*",
}));
app.all("*", function (req, res) {
serviceManager.onRequest(req, res);
});
Expand Down
6 changes: 6 additions & 0 deletions main.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import ServiceManager from "./serviceManager";
import express from "express";
import bodyParser from "body-parser";
import cors from "cors";

const app = express();

Expand All @@ -10,11 +11,16 @@ const PORTFORSERVICES: number = 9999; // @todo Change by configurable port

const serviceManager: ServiceManager = new ServiceManager(PORTFORSERVICES, HOST);

app.use(cors());
app.use(bodyParser.json()); // to support JSON-encoded bodies
app.use(bodyParser.urlencoded({ // to support URL-encoded bodies
extended: true,
}));

app.options("*", cors({
origin: "*",
}));

app.all("*", (req,res) => {
serviceManager.onRequest(req, res);
});
Expand Down
36 changes: 25 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
"typescript": "^3.7.2"
},
"dependencies": {
"@types/cors": "^2.8.6",
"body-parser": "^1.19.0",
"cors": "^2.8.5",
"express": "^4.17.1"
}
}