upgrade version 2.0,add login api,upgrade api verison,add document and unit test

This commit is contained in:
binaryify
2017-04-01 18:42:51 +08:00
parent 35f37afd77
commit a2e4d26401
46 changed files with 714 additions and 614 deletions

20
router/search.js Normal file
View File

@ -0,0 +1,20 @@
const express = require("express")
const router = express()
const { createRequest } = require("../util/util")
router.get("/", (req, res) => {
const keywords = req.query.keywords
const type = req.query.type || 1
const limit = req.query.limit || 30
const data = 's=' + keywords + '&limit=' + limit + '&type=' + type + '&offset=0'
createRequest('/api/search/pc/', 'POST', data)
.then(result => {
res.setHeader("Content-Type", "application/json")
res.send(result)
})
.catch(err => {
res.status(502).send('fetch error')
})
})
module.exports = router