express 项目生成器_用于项目的Express模板生成器(2)| 应用程序结构研究
express 項目生成器
Hello! In express template generator for your projects (1), we looked at express generator and how we can start an express application with stressing to build a brand new structure of all required files.
你好! 在針對您的項目的Express模板生成器(1)中 ,我們研究了Express Generator以及如何著重強調如何構建所有必需文件的全新結構來啟動Express應用程序。
Express generator automatically generates a standard structure or template for an express application.
Express生成器自動為Express應用程序生成標準結構或模板。
Express generator is a tool that helps us build a standard structure or template of the express application with some code to start up.
Express Generator是一種工具,可以幫助我們使用一些代碼來構建Express應用程序的標準結構或模板。
It includes all required modules and dependencies which you'll later install and use.
它包括所有必需的模塊和依賴項,您將在以后安裝和使用。
Take Note! You should have Node js installed in your computer.
做記錄! 您應該在計算機中安裝Node js。
With Node.js already up and running, let's get started.
在Node.js已經啟動并運行的情況下,讓我們開始吧。
We saw how the structure looks like and generated a project example called myapp.
我們看到了結構的外觀,并生成了一個名為myapp的項目示例。
Now, let's explain the meaning of the application structure:
現在,讓我們解釋應用程序結構的含義:
The Bin folder contains a file that contains some server details like port number, required modules and some basic error handling. The file mostly comes with the name www.
Bin文件夾包含一個文件,該文件包含一些服務器詳細信息,例如端口號,所需的模塊和一些基本的錯誤處理。 該文件主要帶有名稱www。
- Changes are rarely made in this folder.
-在此文件夾中很少進行更改。
The Public folder: As the name implies, it's a folder for public use. Therefore, all the resources used or viewed by your users are stored in this folder. These resources could be images, JavaScript and CSS as seen below.
公用文件夾 :顧名思義,它是供公眾使用的文件夾。 因此,您的用戶使用或查看的所有資源都存儲在此文件夾中。 這些資源可以是圖像,JavaScript和CSS,如下所示。
Routes: Routing is a terms that describes the technique of creating different sub domains with separate web pages or documents. For example, a route could be .../home , .../blog ,.../about and ...users.
路由:路由是一個術語,描述了使用單獨的網頁或文檔創建不同子域的技術。 例如,一條路線可以是... / home,... / blog,... / about和... users 。
The folder route stores the various route files. By default express generator configures 2 route files which are
文件夾路由存儲各種路由文件。 默認情況下,Express Generator會配置2個路由文件,分別是
index.js and users.js.
index.js和users.js 。
Views: views are how data can be rendered in html using template engines.
視圖:視圖是如何使用模板引擎以html形式呈現數據。
If no specific template engine is configured, it uses jade also known pug by default.
如果未配置任何特定的模板引擎,則默認情況下它將使用玉器(也稱為pug)。
App.js: app.js is the main file that is initiated at the command prompt. It’s the main express application file that joins all other parts together. It requires all required modules, connects file routes, connects to template engine or views, connects to middleware.
App.js: app.js是在命令提示符下啟動的主文件。 這是將所有其他部分連接在一起的主要Express應用程序文件。 它需要所有必需的模塊,連接文件路由,連接到模板引擎或視圖,連接到中間件。
Package.json file: The package.json file is a file with accurate details about your application. It contains details such as author, name, version, dependencies, etc.
Package.json文件: package.json文件是包含有關您的應用程序的準確詳細信息的文件。 它包含詳細信息,例如作者,名稱,版本,依賴項等。
Below is an example of a package.json file for an express generated project.
以下是快速生成的項目的package.json文件的示例。
Thanks for coding with me. Your comments are most welcome.
感謝您與我一起編碼。 非常歡迎您發表評論。
翻譯自: https://www.includehelp.com/node-js/express-template-generator-for-your-projects-2-a-study-of-the-application-structure.aspx
express 項目生成器
總結
以上是生活随笔為你收集整理的express 项目生成器_用于项目的Express模板生成器(2)| 应用程序结构研究的全部內容,希望文章能夠幫你解決所遇到的問題。
 
                            
                        - 上一篇: Java枚举getDeclaringCl
- 下一篇: a byte of python图书购买
