Skip to Content
Node与Express开发(第2版)
book

Node与Express开发(第2版)

by Ethan Brown
June 2021
Intermediate to advanced
290 pages
9h 21m
Chinese
Posts & Telecom Press
Content preview from Node与Express开发(第2版)
160
第 15章
REST API
和
JSON
虽然第
8
章给出过一些
REST API
的例子,但是目前为止,我们的做事模式几乎是“在服
务器端处理这些数据,然后给客户端发送格式化处理的
HTML
”
。渐渐地,这不再是
Web
应用的默认操作模式。取而代之的是单页应用(
S
PA
),大多数现代
Web
应用属于
SPA
。
SPA
的操作模式是把所有的
HTML
和
CSS
都打成一个静态资源包
,客户端接收整个资源
包,随后依靠接收
JSON
格式的零散数据直接操作
HTML
。与此同时
,提交表单到服务器
来通知变更的重要性降低了,被直接使用
HTTP
请求来跟
API
通信替代。
以前我们使用
Express
提
供格式化处理的
HTML
,现在把注意力转移到使用
Express
提供
API
端点上来
。这些内容在第
16
章将派上大用场,到时会演示我们提供的
API
是如何用
于动态应用渲染的。
本章会将应用的视图都剥离掉,只留下一个“
coming
soon
”的
HTML
界面,到第
16
章再
填充视图。本章将专注于
API
,
这个
API
将提供对度假产品数据库的访问,同时也支持对
产品上市通知的订阅。
Web
服务
是一个宽泛的术语,可以指任何通过
HTTP
访问的
API
。
We
b
服务的理念已经出
现相当长一段时间了,但最近,实现
We
b
服务的技术都太死板、神秘化,而且过度复杂。
现在仍有一些系统在使用这些技术(比如
SOAP
和
WSDL
)
,你也可以使用一些
Node
包来
跟这些系统打交道。不过本章不会讨论这些。我们将专注于提供所谓的
RESTful
风
格的服
务,跟它们打交道要简单直白得多。
缩写词
REST
代表 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

面向对象的思考过程(原书第5版)

面向对象的思考过程(原书第5版)

马特 魏斯费尔德
精通模块化JavaScript

精通模块化JavaScript

Nicolás Bevacqua

Publisher Resources

ISBN: 9787115565099