首页 > Windows开发 > 详细

ReactiveX 学习笔记(18)使用 RxJS + Angular 调用 REST API

时间:2018-08-23 13:39:01      阅读:189      评论:0      收藏:0      [点我收藏+]

JSON : Placeholder

JSON : Placeholder (https://jsonplaceholder.typicode.com/) 是一个用于测试的 REST API 网站。
以下使用 RxJS6 + Angular 6 调用该网站的 REST API,获取字符串以及 JSON 数据。

  • GET /posts/1
  • GET /posts
  • POST /posts
  • PUT /posts/1
  • DELETE /posts/1

除了 DELETE 之外其余4个API都返回JSON数据,格式(JSON-Schema)如下:

{
  "type":"object",
  "properties": {
    "userId": {"type" : "integer"},
    "id": {"type" : "integer"},
    "title": {"type" : "string"},
    "body": {"type" : "string"}
  }
}

创建工程

# 安装 Angular CLI
$ npm install -g @angular/cli
# 创建新的应用程序 RestExample
$ ng new RestExample

```

ReactiveX 学习笔记(18)使用 RxJS + Angular 调用 REST API

原文:https://www.cnblogs.com/zwvista/p/9523127.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!