-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.js
36 lines (31 loc) · 799 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
35
36
/**
* Copyright (C) 2016 yanni4night.com
* app.js
*
* changelog
* 2016-09-08[13:24:41]:revised
*
* @author yanni4night@gmail.com
* @version 0.1.0
* @since 0.1.0
*/
'use strict';
var express = require('express');
var app = express();
var fetch = require('node-fetch');
app.use(express.static(__dirname + '/dist/'));
app.get('/api/topics/hot.json', function (req, res) {
fetch('https://www.v2ex.com/api/topics/hot.json').then(function (res) {
return res.json();
}).then(function (data) {
res.json(data);
});
});
app.get('/api/topics/latest.json', function (req, res) {
fetch('https://www.v2ex.com/api/topics/latest.json').then(function (res) {
return res.json();
}).then(function (data) {
res.json(data);
});
});
app.listen(3000);