应项目需要,故此写个ionic版的豆瓣电影练练手
0.安装ionic,cordova
npm install -g cordova ionic1.初始化工程
ionic start ionic-movie tabs- base
https://api.douban.com/v2 - 搜索
/movie/search?q=${query}&start=${start}&count=${count} - 详情
/movie/subject/${id} - 热映
/movie/in_theaters?start=${start}&count=${count}$city=${city} - 推荐
/movie/top250?start=${start}&count=${count}
0.新建proxy.config.json
{
"/movie": {
"target": "https://api.douban.com/v2",
"secure": false,
"logLevel": "debug",
"changeOrigin": true
}
}1.angular.json中的serve.options,添加"proxyConfig": "proxy.config.json"
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "app:build",
"proxyConfig": "proxy.config.json"
}
}