forked from Anish-Agnihotri/algosearch
-
Notifications
You must be signed in to change notification settings - Fork 2
/
server.local.js
29 lines (21 loc) · 889 Bytes
/
server.local.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
const express = require("express"); // Import express for simplified routing
const cors = require("cors"); // Setup cors for cross-origin requests for all routes
const compression = require("compression");
const app = express(); // Setup express
const port = 8000; // Setup port 8000 for Express server
app.use(cors()); // Enable cors
app.use(compression());
// --> /blockservice/:blocknumber
// --> /all/blocks/:lastBlock/:limit/:full (paginated)
require('./service/query/blocks')(app);
// --> /transactionservice/:txid
// --> /all/transactions/:lastTransaction/:limit/:full (paginated)
// --> /all/addresstx/:address
require('./service/query/transactions')(app);
// --> /address/:address
require('./service/query/addresses')(app);
// --> /stats
require('./service/stats/stats')(app);
// --> /health
require('./service/health/health')(app);
app.listen(port); // Initialize server