File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 1
1
var express = require ( 'express' )
2
2
var path = require ( 'path' )
3
3
var serveStatic = require ( 'serve-static' )
4
+ var axios = require ( 'axios' )
4
5
5
6
var app = express ( )
7
+ var apiRoutes = express . Router ( )
8
+ apiRoutes . get ( '/getSliderData' , function ( req , res ) {
9
+ var url = 'https://c.y.qq.com/musichall/fcgi-bin/fcg_yqqhomepagerecommend.fcg?g_tk=135662383&uin=0&format=json&inCharset=utf-8&outCharset=utf-8¬ice=0&platform=h5&needNewCode=1&_=1504085676400'
10
+
11
+ axios . get ( url , {
12
+ headers : {
13
+ referer : 'https://m.y.qq.com/'
14
+ }
15
+ } ) . then ( ( response => { res . json ( response . data ) } ) ) . catch ( err => {
16
+
17
+ console . log ( ' 自建的代理出错! ' , err )
18
+ } )
19
+
20
+ } )
21
+
22
+ app . use ( '/api' , apiRoutes )
6
23
app . use ( serveStatic ( path . join ( __dirname , 'dist' ) ) )
7
24
8
25
var port = process . env . PORT || 5000
You can’t perform that action at this time.
0 commit comments