express实例
# express实例
import express, { Express, Router, Request, Response } from 'express'
import axios from 'axios'
const app: Express = express()
app.use('*',(req,res,next)=>{
res.header('Access-Control-Allow-Origin', '*')
next()
})
const router: Router = express.Router()
app.use('/api', router)
router.get('/list', async (req: Request, res: Response) => {
const result = await axios.post('https://api.inews.qq.com/newsqa/v1/query/inner/publish/modules/list?modules=statisGradeCityDetail,diseaseh5Shelf')
res.json({
...result.data.data
})
})
app.listen(3333,()=>{
console.log('success server http://localhost:3333')
})
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
上次更新: 2024/08/14, 04:14:33