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版)
Express
的方式
|
19
了各种必备的知识和技能,可以评估脚手架工具所生成的脚手架对你是否有用了。要了解
更多信息,请查看
express-generator
的文档。
3.2
 草地鹨旅游网站
贯穿本书,我们将使用一个持续更新的示例网站:为草地鹨旅游公司(
Meadowlark Travel
)
而做的一个假想的网站,这个公司是为到俄勒冈州旅行的人提供服务的。如果你对创建
API
更感兴趣,不用担心:这个网站除了提供功能正常的网页之外,还会暴露一套
API
。
3.3
 初始工作
先创建一个新目录,这将是你的项目的根目录。在本书中,每当说项目目录、应用目录或
应用根目录,都是指这个目录。
你可能想让
Web
应用的文件跟通常属于项目的其他文件(例如会议笔记、文
档等)分离。为此,推荐你把应用目录作为项目目录的子目录。例如,对
于草地鹨旅游网站,我会把项目放在
~/projects/meadowlark
中
,把应用放在
~/projects/meadowlark/site
中。
npm
在一个名为
package.json
的文件里管理项目的依赖关系以及项目的元数据。创建这个
文件的最简单方式是运行
npm init
:它会问你一系列问题,然后生成
package.json
文件以
开始项目(对于“
entry point
”这个提问,按照项目名,使用
meadowlark.js
)。
每次运行
npm
,你可能都会收到一条警告信息,提示缺少项目描述或版本
库字段。忽略这些警告是没问题的,不过如果你想消除它们,则需要编辑
package.json
文件
,填上
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