-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
54 lines (47 loc) · 1.03 KB
/
Copy pathindex.js
File metadata and controls
54 lines (47 loc) · 1.03 KB
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
const express = require('express');
const cors = require('cors');
const path = require('path');
const app = express();
app.use(cors());
app.use(express.json());
app.use(express.static(path.join(__dirname, 'public')));
app.get('/api/health', async (req, res) => {
res.json({
status: 'ok',
uptime: Math.floor(Date.now() / 1000),
db: {
total: 1444,
important: 394,
sources: [
{ source: 'BlockBeats', n: 244 },
{ source: 'HTX', n: 104 },
{ source: 'Matrixport', n: 90 },
],
},
version: '1.2.0',
});
});
app.get('/api/news', async (req, res) => {
res.json({
success: true,
count: 0,
page: 1,
lastUpdate: new Date().toISOString(),
data: [],
});
});
app.get('/api/stats', async (req, res) => {
res.json({
success: true,
data: {
total: 1444,
important: 394,
categories: [],
sources: [],
},
});
});
app.get('/{*path}', (req, res) => {
res.sendFile(path.join(__dirname, 'public', 'index.html'));
});
module.exports = app;