欧美日韩电影精品视频_亚洲天堂一区二区三区四区_亚洲欧美日韩国产综合_日韩精品一区二区三区中文_為您提供優質色综合久久88色综合天天

您的位置:首頁 > 宏觀 >

Bilingual Express tutorial in English and Chinese (中英雙語 Express

2023-08-18 07:51:06 來源:嗶哩嗶哩

評論

1. Introduction 介紹

Express is a fast, unopinionated, minimalist web framework for 是一個(gè)快速的、靈活的、極簡的 Nodejs 開發(fā)框架

Fast 快速的

You can use it easily and quickly.它很簡單,你可以快速上手


(相關(guān)資料圖)

unopinionated 靈活的

An unopinionated framework gives developers more control and the ability to shape their software according to their own preferences, while an opinionated framework provides a more structured and standardized approach to development.一個(gè)靈活的框架會(huì)將項(xiàng)目的控制權(quán)交給開發(fā)者,允許他們根據(jù)自己的實(shí)際需求定制項(xiàng)目功能.然而,一個(gè)“強(qiáng)約束”的框架會(huì)有很多的代碼組織標(biāo)準(zhǔn)來約束開發(fā)者

minimalist 極簡的

You can create a Nodejs server by a few lines of code.你可以使用很少的代碼,就能創(chuàng)建一個(gè) Nodejs 服務(wù)

2. Create An Express Application(搭建 Express 項(xiàng)目)

If you want to create a Nodejs server useing Express,you need to set up an Express project first.?Express provides a tool called “express-generator” which allows you to set up an Express Application quickly.如果你想基于 Express 搭建一個(gè) Nodejs 服務(wù),你需要先初始化一個(gè) Express 項(xiàng)目。Express 為我們提供了一個(gè)名為“express 生成器”的工具,我們可以使用這個(gè)工具快速搭建 Express 項(xiàng)目。

Next,Let's finger out how to use "express-generator"接下來我們演示一下,如何使用“express 生成器”

Step1

Use npm to install "express-generator" globally in your computer使用 npm 在你的電腦上全局安裝 express-generator

npm i express-generator -g

Step2

Use the express command to set up your Express Application使用 express 命令創(chuàng)建 express 項(xiàng)目

express --no-view --git express-project

--no-view means do not use any template engine such as "ejs".By default, generator will choose a template engine to render the data.

--no-view 意思是:不使用任何模板引擎。默認(rèn)情況下 generator 生成器會(huì)自己選一個(gè)模板引擎來渲染數(shù)據(jù)。

--git means create a .gitignore file by default

--git 可以讓生成器幫我們創(chuàng)建一個(gè).gitignore 文件

express-project is your own project name

express-project 是自定義的項(xiàng)目名稱

Step3

Now, we can see an application named "express-project" there. We need to start it up by useing the followling commands.這個(gè)時(shí)候,我們可以看到一個(gè)名為 express-project 的項(xiàng)目已經(jīng)創(chuàng)建好了。我們還需要使用下面的命令啟動(dòng)它。

1. Please make sure to excute the following commands in the directory of your application.請確保在你自己的項(xiàng)目目錄下,執(zhí)行下面所有命令.

cd express-project

2. Install all the dependencies useing Npm

使用 npm 安裝項(xiàng)目所需依賴

npm i

3. Start it up? ?啟動(dòng)項(xiàng)目

npm run start

4. Try to access 'http://localhost:3000' in your you can see some words like 'Express,Welcome to Express',it means your Node server has started up successfully. Congratulations!

嘗試在瀏覽器中訪問 http://localhost:3000,如果看到類似“Express,Welcome to Express”的字樣。說明你已經(jīng)成功啟動(dòng)了 Node 服務(wù)。恭喜你!

Use WeiXin to Scan The Qrcode 微信掃描二維碼

There are many different IT courses in this miniprograme,such as,IoT,AI,Big Data,Backend Development,Frontend Development,UI and more. Please scan it and enjoy yourself.在這個(gè)微信小程序中,有很多不同類型的 IT 課程,例如:物聯(lián)網(wǎng)、人工智能、大數(shù)據(jù)、后端開發(fā)、前端開發(fā)、UI 設(shè)計(jì)等。請掃碼盡情觀看學(xué)習(xí)吧。

關(guān)鍵詞:

[責(zé)任編輯:]

相關(guān)閱讀