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的项目示例。

express template generator 1 1

Now, let's explain the meaning of the application structure:

现在,让我们解释应用程序结构的含义:

  1. 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.

    -在此文件夹中很少进行更改。

  2. 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,如下所示。

  3. express template generator 2 2




  4. 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.jsusers.js

  5. express template generator 2 3




  6. 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)。

  7. 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应用程序文件。 它需要所有必需的模块,连接文件路由,连接到模板引擎或视图,连接到中间件。

  8. express template generator 2 4




  9. 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文件的示例。

express template generator 2 5

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 项目生成器

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/543693.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

简单的block

int multi 7; int (^myBlock)(int) ^(int num){ return num * multi; }; int result myBlock(5); NSLog("结果是:%d",result);//输出结果是: 结果是:35 void (^printBlock)(NSS…

c# 浮点数十六进制字符串_从C#中包含十六进制值的字符串数组中打印整数值...

c# 浮点数十六进制字符串将十六进制字符串数组转换为整数 (Converting array of hexadecimal strings to integers) Let suppose you have some of the strings (i.e. array of strings) containing hexadecimal values like "AA", "ABCD", "ff21&quo…

Linux 服务器中文乱码编码解决

Linux环境的ECS中,若出现如下中文显示为乱码的情况。 一般原因如下: 1. 未安装中文语言包 2. 未设置正确的默认语言 3. SSH 终端未正确配置 本文以Centos 6.5为例,演示如何解决中文乱码问题。 1. 使用 locale -a |grep zh_CN查看系统是否已经安装…

Python | 如何强制除法运算为浮点数? 除数一直舍入为0?

Until the python version 2, the division of two integers was always being rounded down to 0. 在python版本2之前, 两个整数的除法总是四舍五入为0 。 Consider the below example, being executed in python version 2.7, 考虑下面的示例,该示例在…

Python程序输入一个字符串并查找总数的大写和小写字母

Given a string str1 and we have to count the total numbers of uppercase and lowercase letters. 给定字符串str1 ,我们必须计算大写和小写字母的总数。 Example: 例: Input: "Hello World!"Output:Uppercase letters: 2Lowercase lette…

Android(Xamarin)之旅(三)

原文:Android(Xamarin)之旅(三)前面两篇说到了Xamarin的安装和一些简单的控件,今天来说说一些对话框和提示信息,以及简单的布局元素。 一、对话框和提示信息 一、对话框 我们首先从简单的对话框开始。 1、普…

java中为按钮添加图片_我们可以在Java接口中为成员定义私有和受保护的修饰符吗?...

java中为按钮添加图片No, it is not possible to define private and protected modifiers for the members in interfaces in Java. 不可以,无法为Java接口中的成员定义私有修饰符和受保护的修饰符。 As we know that, the members defined in interfaces are imp…

android Monkey 测试技巧

MonkeyTest 测试流程1、常用的命令参数说明:-sseed值,设置这个参数的主要作用是程序员可以重复执行这个命令,seed值相同则monkey测试序列也大致一样。-p 指定要测试的包,参数跟的是apk的package id--pct-touch 调整触摸…

十六进制数制到二进制,八进制和十进制数制的转换

Prerequisite: Number systems 先决条件: 数字系统 1)将十六进制数制转换为二进制数制 (1) Conversion of Hexadecimal Number System to Binary Number System) To convert hexadecimal numbers into binary numbers, we can use the relationship between hexade…

ldo regula_使用C中的Regula Falsi方法找到复多项式方程的根

ldo regulaRegula Falsi方法 (Regula Falsi method) About the method: 关于方法: We often hear many children and even many adults complaining about the difficulty level that they face while solving complex polynomial equations. It is also difficult…

解决一次由于SSL证书到期导致的网站不能访问的问题(Nginx,php,Apache)

1. 现象放假期间收到zabbix报警,提示主站访问不了,报502。2.排查思路及过程因为是过年休息,放假前又没有更新,基本可以排除是更新和配置导致的问题。ssh连上服务器发现服务器连接和资源都没问题。这是一套lnamp架构的网站&#xf…

python字典按键值排序_在Python中按键或值按升序和降序对字典排序

python字典按键值排序Problem Statement: Write a Python program to sort (ascending and descending) a dictionary by key or value. 问题陈述:编写一个Python程序,以按键或值对字典进行排序(升序和降序)。 Example: 例: Input: diction…

Try Redis : Redis 入门教程

开篇 Redis 是一种以键值对(key-value)存储数据的NoSQL数据库。 键值对存储数据的本质是以某个键存储某个值。之后你可以用这个键把存储的值取出来。可以用SET命令以键‘servername’存储值‘fido’: SET servername fido这样,数据…

在C ++中使用getter和setter函数创建具有X和Y轴的类Point

We have two declare a point class with two Axis X and Y and we have to create/design its getter and setter functions. 我们有两个声明带有两个Axis X和Y的点类,并且我们必须创建/设计其getter和setter函数。 As we know that a class has some data member…

go newscanner判断文件读取结束_Go单元测试-testing

在开发程序中,很重要一点就是测试,测试可以保证代码的质量,保证每个函数可以正常运行。但是如何保证写出来的程序是否正确。单元测试一般是用来测试我们的代码逻辑有没有问题,有没有按照我们期望的运行,以保证代码质量…

_.uniq_在Ruby中使用Array.compact和Array.uniq方法从Array中移除元素

_.uniqRuby Array.compact和Array.uniq方法 (Ruby Array.compact and Array.uniq Methods) In the last article, we have gone through two different methods of deleting elements from the Array. We have seen their implementation with the help of their syntaxes and …

清除缓存的实现

现有的清除缓存存在着一些问题,占坑查询,后续进行完善转载于:https://www.cnblogs.com/lazVy/p/5192244.html

divi模板下载_Java Math类静态double IEEEremainder(double divi,double divisor)的示例

divi模板下载数学类静态double IEEEremainder(double divi,double divisor) (Math Class static double IEEEremainder(double divi , double divisor)) This method is available in java.lang package. 此方法在java.lang包中可用。 This method is used to retur…

nextdate函数白盒测试问题 软件测试_软件测试基本常识

一、软件测试的分类:1.按照是否执行被测试软件来分:静态测试:是指不运行软件,测试包括代码检查、静态结构分析、代码质量度量等,主要对软件需求说明书、设计说明书、软件源代码进行检查与分析。 动态测试:…

java 大小写转换函数_不使用Java中的任何库函数将大写转换为小写

java 大小写转换函数Given a string and we have to convert it from uppercase to lowercase. 给定一个字符串,我们必须将其从大写转换为小写。 Examples: 例子: Input:IncludeHelp.comOutput:includehelp.comInput:[email protected]Output:[email p…