-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
34 lines (30 loc) · 840 Bytes
/
app.js
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
const express = require("express");
const bodyParser = require("body-parser");
const searchEngine = require("./channel");
var portfinder = require("portfinder");
var cors = require("cors");
const app = express();
searchEngine.searchClose();
searchEngine.ingestClose();
searchEngine.searchConnect();
searchEngine.ingestConnect();
app.use(
cors({
allowedHeaders: ["sessionId", "Content-Type"],
exposedHeaders: ["sessionId"],
credentials: true,
origin: ["127.0.0.1", `http://localhost`, `http://localhost:3000`],
})
);
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
const routes = require("./routes");
app.use("/yet/api", routes);
portfinder.getPort((err, port) => {
if (err) {
console.log(err);
}
app.listen(3000, () => {
console.log(`http://localhost:3000`);
});
});