-
Notifications
You must be signed in to change notification settings - Fork 1
/
word.prod.server.js
40 lines (33 loc) · 1.28 KB
/
word.prod.server.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
var express = require('express')
var axios = require('axios')
var util = require("util")
var config = require('./config')
var compression = require('compression')
var app = express()
var apiRoutes = express.Router()
apiRoutes.get('/word', function (req, res) {
var url = 'http://word.iciba.com'
axios.get(url, {
headers: {
referer: 'word.iciba.com',
host: 'word.iciba.com',
Cookie:'_ustat=%7B%22i%22%3A%2212560797%22%2C%22n%22%3A%22275894290%40qq.com%22%2C%22e%22%3A%22275894290%40qq.com%22%2C%22s%22%3A%7B%22u%22%3Atrue%2C%22m%22%3Atrue%2C%22e%22%3Afalse%7D%2C%22t%22%3A1498468157%2C%22sid%22%3A%22127bcb59fae0a17864e9209190c87ebd%22%7D; _last_active=a%3A3%3A%7Bs%3A1%3A%22i%22%3Bs%3A8%3A%2212560797%22%3Bi%3A0%3Bi%3A1498468157%3Bs%3A1%3A%22u%22%3Bs%3A14%3A%22word.iciba.com%22%3B%7D; PHPSESSID=3t6fq0hvs4c9o26n7chmntbik6'
},
params: req.query
}).then((response) => {
res.send(util.inspect(response,{depth:null}))
}).catch((e) => {
console.log(e)
})
})
app.use('/api', apiRoutes)
app.use(express.static('./dist'))
app.use(compression())
var port = process.env.PORT || config.build.port
module.exports = app.listen(port, function (err) {
if (err) {
console.log(err)
return
}
console.log('app listening at http://localhost:' + port + '\n')
})