创建服务: ![](https://img.kancloud.cn/45/15/451557c5c50dd44175c9eff1e0f5e2b2_761x455.png) **安装erpress** ``` npm init -y npm install express --save ``` express创建服务: ![](https://img.kancloud.cn/fc/d7/fcd79da8a91e492cbbd51a868a7754d9_1013x443.png) ![](https://img.kancloud.cn/c3/c7/c3c7ad1db41ef17171e67b9f37404bad_932x456.png) ![](https://img.kancloud.cn/f2/e3/f2e35167d1e7731f489cd58e0018d523_686x357.png) ![](https://img.kancloud.cn/8c/80/8c8014ca428bd134e7b8b28806700eaa_877x334.png) ![](https://img.kancloud.cn/da/ca/dacaeef876a937af8b4d4488fb109448_741x446.png) ![](https://img.kancloud.cn/4e/05/4e05d6ff7f2a68260c6c7ae5a71c9595_666x108.png) ![](https://img.kancloud.cn/94/0b/940b90eea0d41ca88e63e70c49a7336e_793x345.png) ![](https://img.kancloud.cn/c4/ce/c4ce376bc06b55456494dc5887ce96fc_617x350.png) ![](https://img.kancloud.cn/89/0d/890d71bf17e4c888271bc81b02a16498_624x491.png) ![](https://img.kancloud.cn/38/fb/38fbf8f5e46f4ec329c3bbaa79c4d6f2_644x298.png) ![](https://img.kancloud.cn/b1/f5/b1f54d3ffcb79849a98335b1b7d2074b_816x404.png) ![](https://img.kancloud.cn/1d/4d/1d4d3c02339755f7544a405c58f00ebc_840x464.png) ![](https://img.kancloud.cn/c0/2a/c02aefdbf6d44cc3bbaac0002d0eff9f_608x534.png) ![](https://img.kancloud.cn/a0/a5/a0a5444e31a7fd56ab7e105c2cd643f8_749x568.png) ![](https://img.kancloud.cn/fd/27/fd27801fffd924abae4b000146b56fa2_780x605.png) ![](https://img.kancloud.cn/da/26/da261be9b0cb887e0512f24463f516fc_821x496.png) ****使用的是art-template引擎**** ![](https://img.kancloud.cn/ec/32/ec3221b1d8561794727707c6fd519122_831x472.png) ![](https://img.kancloud.cn/24/d2/24d284b89d4472783644fa6f447d8fa4_754x541.png) ![](https://img.kancloud.cn/95/10/951055cc13c57bdb7aace483f7376511_819x253.png) ![](https://img.kancloud.cn/5e/62/5e62c563ce604958529dfbbe187be642_836x291.png) ![](https://img.kancloud.cn/b0/fc/b0fc17e7a527fc2899ec7d599b29a642_715x355.png) ![](https://img.kancloud.cn/7b/90/7b9066adf0b6d97f3a5e3553b543e7f3_887x410.png) ![](https://img.kancloud.cn/55/66/5566e01d3592970154af58b6d7c6ef92_763x331.png) ![](https://img.kancloud.cn/b1/9a/b19a745f334ee7a86c66123a88f7777f_737x242.png) **express框架:** ![](https://img.kancloud.cn/23/1f/231f3ee12fe0bd393966d5990e4dd814_422x110.png) ![](https://img.kancloud.cn/ca/42/ca42296dc58da0c4643a185de696cdf6_748x650.png) ![](https://img.kancloud.cn/85/27/85278d3239de5a1aeb3eab2dd77aa9ff_669x456.png) ![](https://img.kancloud.cn/71/78/717886d42815f89c18833e5ea0d82fa9_755x671.png) ![](https://img.kancloud.cn/fd/9c/fd9cab08a9cebee4fa8e41f7137d08be_650x437.png) **使用中间件** ![](https://img.kancloud.cn/4f/6e/4f6e57fdb30b8bcdd1e2d86777ef07f1_1066x577.png) 不加next() 第一个匹配后 不会向下执行 中间件的使用方法 ![](https://img.kancloud.cn/0f/5a/0f5a6db481fa9097659fc147855c858f_765x165.png) 就会匹配下面的也就是第一个含有err的中间件 ![](https://img.kancloud.cn/df/53/df53c9d972a99bf89441483fc0cbad37_528x129.png) ![](https://img.kancloud.cn/5a/08/5a08c81e6c8f3586652fb09d490e8093_875x451.png)