《Ant Design Pro v5 获取动态菜单与基于角色权限管理视频教程》 和 《零基础学习 Vue3 教程 2021 年最新教程 免费视频教程》 正在更新
世界上最伟大的投资就是投资自己的教育
https://api.github.com/users/hfpp2012
https://github.com/hfpp2012/TypeScript-Nodejs-Github-Report/tree/02_request
https://developer.github.com/v3/#user-agent-required).
https://github.com/request/request#custom-http-headers
https://github.com/stedolan/jq
https://stedolan.github.io/jq/download/
npm start | grep -vE "^typescript|^tsc|\ " | jq
import * as request from 'request';
const options = {
headers: {
'User-Agent': 'request'
}
};
export class GithubApiService {
getUserInfo(userName: string) {
request.get("https://api.github.com/users/" + userName, options, (error: any, response: any, body: any) => {
console.log(body);
})
}
}
src/index.ts
import { GithubApiService } from './GithubApiService';
let svc: GithubApiService = new GithubApiService();
svc.getUserInfo("hfpp2012");
1FreeTypeScript + Node.js 实战 GitHub API #1 项目搭建
2FreeTypeScript + Node.js 实战 GitHub API #2 安装依赖和发送 API 请求
FreeTypeScript + Node.js 实战 GitHub API #3 增加头信息发送 API 请求和命令行格式化 JSON 数据
4FreeTypeScript + Node.js 实战 GitHub API #4 得到 JSON 数据和创建 User model(今天第三更)
5FreeTypeScript + Node.js 实战 GitHub API #5 使用回调函数(今天第四更)
6FreeTypeScript + Node.js 实战 GitHub API #6 创建 Repo model
7FreeTypeScript + Node.js 实战 GitHub API #7 组合回调函数和使用 lodash 进行数组的排序
© 汕尾市求知科技有限公司 | 关注我们 | 专业版网站 | 在线学员:1140
粤公网安备 44152102000088号 | 粤ICP备19038915号
格式化的那个命令可以提供1下吗,我想看看我哪里打错了。
可以
npm start | grep -vE "^typescript|^tsc|\ " | jq
let svc: GithubApiService = new GithubApiService();
这一行代码,let svc: GithubApiService这样写是啥意思?GithubApiService 又不是数据类型,也不是个接口,你怎么可以给svc定义成GithubApiService类型啊?GithubApiService只是你写的一个clas类啊
https://www.qiuzhi99.com/movies/typescript/522.html