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版)
218
|
第
19
章
价。我见过页面的加载时间因为额外的
HTTP
请求而变成了原来的
2
倍甚至
3
倍的情况。
如果页面性能对你来说很重要(应该是这样的,尤其是从移动端用户的角度考虑),就需
要仔细考虑应该如何集成社交媒体。
虽然这么说,但是实现了
Facebook
的“喜欢”按钮或“发推”按钮的代码还是需要利用浏
览器内的
Cookie
并以用户的名义提交。要把这个功能移到后端,可能会很困难(而且,在
有些情形中是不可能的)。因此,如果你需要的是“喜欢”按钮或“发推”按钮那样的功
能,那么在页面中引用合适的第三方库是你最好的选择,即使它会影响页面的性能。
19.1.2
 搜索推文
如果希望展现最近
10
条包含主题标签“
#Oregon #travel
”的推文,的确可以使用一个前端
组件来实现,但这样做会产生额外的
HTTP
请求
。而如果在后端实现,则可以为了满足性
能的需要而缓存这些推文。而且,如果搜索是在后端进行的,就可以把一些很刻薄的推文
“拉黑”,但在前端实现就会相对困难一些。
跟
Facebook
一
样,
Twitter
允许你创建
应用
。说是应用,其实有些不恰当,因为一个
Twitter
应用并不做任何事情(在传统意义上)。它更像是在网站上可以用来创建实际应用的“凭
证”。要访问
T
witter API
,最容易且最可移植的方式是创建一个应用,再通过这个应用来
获取访问令牌。
要想创建
T
witter
应用,首先需要进入它的开发者中心。先确认登录,然后点击导航栏
中你的用户名,再点击
Apps
。接着点击
“
Create an app
”,并遵照说明操作 ...
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