forked from Fantom-foundation/Artion-Server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
85 lines (76 loc) · 2.36 KB
/
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
const express = require("express");
const app = express();
require("dotenv").config();
const mongoose = require("mongoose");
const bodyParser = require("body-parser");
const cors = require("cors");
const port = process.env.PORT || 5001;
const Logger = require('./services/logger');
const morganMiddleware = require('./apis/middleware/morgan');
app.use(
bodyParser.urlencoded({
extended: false,
})
);
require("./models/abi");
require("./models/account");
require("./models/bid");
require("./models/category");
require("./models/collection");
require("./models/erc721contract");
require("./models/erc721token");
require("./models/erc1155contract");
require("./models/erc1155token");
require("./models/nftitems");
require("./models/event");
require("./models/highestblock");
require("./models/listing");
require("./models/notification");
require("./models/offer");
require("./models/tradehistory");
require("./models/auction");
require("./models/erc1155holding");
require("./models/banneduser");
require("./models/bannenft");
require("./models/bundle");
require("./models/bundleauction");
require("./models/bundlebid");
require("./models/bundleinfo");
require("./models/bundlelisting");
require("./models/bundleoffer");
require("./models/bundleHistory");
require("./models/follow");
require("./models/like");
require("./models/bundlelike");
require("./models/factorycollection");
require("./models/notificationsetting");
require("./models/moderator");
require("./models/turkwork");
require("./models/sitelock");
require("./models/paytoken");
require("./models/unlockable");
require("./models/disabledExplorerCollection");
app.use(bodyParser.json());
app.use(express.json());
app.use(
cors()
);
app.options("*", cors()); // include before other routes
app.use(morganMiddleware);
app.use(require("./apis"));
const priceFeed = require("./services/price.feed");
const connect = () => {
const uri = process.env.DB_URL;
mongoose.connect(uri, { useNewUrlParser: true, useUnifiedTopology: true });
const db = mongoose.connection;
db.on("error", console.error.bind(console, "connection error:"));
db.once("open", function () {
Logger.info("artion server has been connected to the db server");
Logger.info("price feed has been started");
priceFeed.runPriceFeed();
app.listen(port, () => {
Logger.info(`artion server is running at port ${port}`);
});
});
};
connect();