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版)
50
|
第
5
章
lib/handlers.js
,在错误处理函数前后加上一些东西:
// Express根据4个参数来认出它是错误处理函数,
// 因此我们要禁用ESLint的no-unused-vars规则
/* eslint-disable no-unused-vars */
exports.serverError = (err, req, res, next) => res.render('500')
/* eslint-enable no-unused-vars */
Linting
起初会给你带来一些小麻烦——好像总在不停地找碴儿。当然,对于不适合你的规
则,可以放心地禁用它。到最后,随着逐渐学会避免那些(
Linting
本来要捕获的)常见的
人为失误,你的麻烦就会越来越少。
测试和
Linting
无疑都很有用
,但是如果从不使用,任何工具都是毫无价值的。花时间
和精力去编写单元测试并设置
Linting
似乎很疯狂
,但我看到过这种情况,尤其是在压
力很大的时候。幸运的是,有一个办法可以保证你不会忘记这些有用的工具,那就是持
续集成。
5.10
 持续集成
这里我向你提出另一个极其有用的
QA
概念:持续集成(
CI
)。在团队工作中,它显得尤
其重要,即便你是独自工作,它也可以提供一些很有帮助的准则。
从本质上来说,每当你向源代码的版本库提交了代码,
CI
就会运行某些或全部测试
(你
可以控制要应用到版本库的哪些分支)。如果所有这些测试都通过了,一般不会有什么事
(你可能会收到一封邮件说“干得不错”,不过这取决于你的
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
前端架构设计

前端架构设计

Micah Godbolt

Publisher Resources

ISBN: 9787115565099