官术网_书友最值得收藏!

The best parts of Express

When searching the Web for information on Express, we find that it is a minimal and flexible web framework that adds the essential bits and pieces needed to create powerful web applications.

It is minimal because it provides the basic features we need to create web applications, such as routing based on URL paths (it has DSL to describe routes), support for template engines, cookie and session management, the parsing of incoming requests, and so on. Without these built-in features, we need to create our own custom solutions on top of the Node HTTP. The source code for Express is just a few thousand lines of code, enabling us to easily dig deeper for a better understanding of how things work internally.

The flexibility comes from the fact that this framework does not impose things such as a certain application structure or database layer. Furthermore, not every middleware available is included by default when creating an application (unlike other big, monolithic frameworks); we have to explicitly include what we want. Even though Express is not a typical Model-View-Controller (MVC) framework, there's nothing stopping us from customizing it to be one if our requirements dictate it.

We can build different kinds of applications with Express, such as REST APIs, single-page and multipage applications, real-time applications, applications that spawn external processes and output their result, and many others. Due to its intuitive API and flexibility, Express makes it easy for newcomers to get started with the framework and use it for rapid prototyping when needed. Although there are methods to facilitate certain actions (such as redirecting the user to another page or serving JSON data), the functions built into Node are also available for this purpose.

The out-of-the-box performance of Express is really good; it can handle thousands of concurrent connections per second (the results are dependent on the concrete use case). An application can always be improved through caching, scaling to multiple processes, or other techniques, but it's good to know that Express won't be our bottleneck.

主站蜘蛛池模板: 衡东县| 潼南县| 杨浦区| 上栗县| 台北市| 晋中市| 米易县| 通辽市| 赣州市| 平阴县| 长垣县| 贡嘎县| 昭苏县| 甘肃省| 广西| 读书| 奎屯市| 保康县| 桐庐县| 灵石县| 连平县| 赣州市| 嘉峪关市| 怀化市| 黑龙江省| 中阳县| 墨竹工卡县| 仪陇县| 漳州市| 黔东| 营山县| 汪清县| 临澧县| 康保县| 贵溪市| 云安县| 格尔木市| 滦平县| 隆昌县| 治县。| 陈巴尔虎旗|