node 大写

Today, let's see a third party module that helps us in working with upper-case letters without necessarily typing them in upper-case in our source code.

今天,让我们看一个第三方模块,它可以帮助我们处理大写字母,而不必在源代码中以大写字母键入它们。

You may find it useless! But it's very important.

您可能会发现它没有用! 但这很重要。

For example, you may have a form where you require your users to fill in upper-case letters only. You may wish to add a function where any typed in the letter appears in upper-case even though typed in lower-case from the keyboard.

例如,您可能有一个表单,要求您的用户仅填写大写字母。 您可能希望添加一个功能,即使从键盘输入小写字母,字母中的任何字母都以大写形式显示。

Like said before, Node modules are like libraries which help us perform specific tasks. Node.JS is always considered powerful because it has a very large ecosystem of third-party modules.

如前所述,Node模块就像是可以帮助我们执行特定任务的库。 Node.JS一直被认为是功能强大的,因为它具有非常庞大的第三方模块生态系统。

The upper-case module is a third-party module built by some experts to help us.

大写模块是一些专家构建的第三方模块,可以帮助我们。

Take Note! You should have Node.js installed in your PC.

做记录! 您应该在PC中安装了Node.js。

With Node.js already up and running, let's get started.

在Node.js已经启动并运行的情况下,让我们开始吧。

Now, let's get started.

现在,让我们开始吧。

First of all, install the upper-case module by typing npm install upper-case via the command line.

首先,通过在命令行中键入npm install upper-case来安装大写 模块

Wait for a while as it downloads.
NB: Internet required!

等待下载。
注意:需要互联网!

Take note that only third party modules are installed via command line unlike built in modules which comes along with the node.js environment when downloaded...

请注意,不同于第三方模块在下载时随Node.js环境一起提供的内置模块,仅通过命令行安装了第三方模块。

Let's look at a basic use of the upper-case module.

让我们看一下大写模块的基本用法。

We'll create an http server that will output hello world in capital letters but written in small letters in the source code.

我们将创建一个http服务器,该服务器将以大写字母输出问候世界,但在源代码中以小写字母书写。

Open a text editor and type the following code and save it with the file name app.js:

打开一个文本编辑器,输入以下代码,并将其保存为文件名app.js

var http = require('http');  // includes the http module
var uc = require('upper-case'); // include the upper-case module
http.createServer(function (req, res) {res.writeHead(200, {'Content-Type': 'text/html'});
res.write(uc("hello world!")); // assign the upper-case module
res.end();
}).listen(8080); // port number

Note: The file should be saved in your default Node.js directory.

注意:该文件应保存在默认的Node.js目录中。

Initiate the JavaScript file at the console by typing node app.js

通过键入节点app.js在控制台上启动JavaScript文件

Take Note! : Your command line directory should be same with Node.js module directory.

做记录! :您的命令行目录应与Node.js模块目录相同。

Finally, open your browser and navigate to http://localhost:8080

最后,打开浏览器并导航到http:// localhost:8080

Thanks for coding with me. Your comments are most welcome.

感谢您与我一起编码。 非常欢迎您发表评论。

翻译自: https://www.includehelp.com/node-js/upper-case-node-js-module.aspx

node 大写

node 大写_大写Node.js模块相关推荐

  1. 对应node版本_安装Node.js教程

    小编首先下载Node.js,首先打开浏览器,然后输入https://nodejs.org/en/,进入nodejs官网,然后按照下图中红色箭头指示步骤2,这个是nodejs8.12版本,下面Recom ...

  2. node 存储过程_用Node.js操作跨平台数据库Firebird

    FireBird Firebird是一个跨平台的关系数据库系统,目前能够运行在Windows.linux和各种Unix操作系统上,提供了大部分SQL-99标准的功能.它既能作为多用户环境下的数据库服务 ...

  3. 如何设置单词第一个字母大写_大写一行中每个单词的第一个和最后一个字母

    如何设置单词第一个字母大写 Problem statement: 问题陈述: Given an input line, capitalize first and last letter of each ...

  4. java node类_请问Node是Java库当中的一个类吗?

    Node 是org.w3c.dom包下定义接口其子接口很多 javax.xml.soap的Node接口方法定义如下 getValue String getValue()如果这是一个 Text 节点,则 ...

  5. node.js中模块_在Node.js中需要模块:您需要知道的一切

    node.js中模块 by Samer Buna 通过Samer Buna 在Node.js中需要模块:您需要知道的一切 (Requiring modules in Node.js: Everythi ...

  6. node.js 模块_如何创建Node JS可重用模块

    node.js 模块 In my previous post, we have discussed about "How to export and import a Node JS Mod ...

  7. Node.js 模块之Nimble流程控制

    NodeJS异步的特性有时候会导致程序非常的难看,回调一层套着一层,这个时候就要用流程控制模块来控制究竟是同步还是异步了. Nimble是一个轻量.可移植的函数式流程控制模块.经过最小化和压缩后只有8 ...

  8. node mysql 模块化_Node.js 模块系统

    Node.js模块系统 为了让Node.js的文件可以相互调用,Node.js提供了一个简单的模块系统. 模块是Node.js 应用程序的基本组成部分,文件和模块是一一对应的.换言之,一个 Node. ...

  9. 编写原生的Node.js模块

    通常,我们开发原生Node.js模块包括但不仅限于以下原因: 对性能有比较苛刻要求的应用.尽管Node.js得益于libuv,在异步I/O操作很有优势,但遇到数字计算时并不是一个很好的选择. 使用更加 ...

最新文章

  1. 开启Thread线程只执行一次
  2. vfp赋值超过7位出错_JDK1.7下的HashMap的源码分析
  3. 独家 | 蚂蚁金服TRaaS技术风险防控平台解密
  4. ASCII,Unicode,UTF-8,GB2312一些关于编码的理解
  5. sap 设置服务器信息,服务器上配置sap
  6. 华氏度和摄氏度的相互转化
  7. 【论文笔记】Learning Convolutional Networks for Content-weighted Image Compression
  8. input file选择图片后预览 单图和多图
  9. python中np.array的shape(2,)与shape(1 ,2)的运算细节
  10. Frenet坐标系与Cartesian坐标系互转(一):公式推导
  11. 忆阻器类脑芯片与人工智能
  12. 淘晶驰串口屏入门(四)进度条、滑块、定时器、单选框、复选框、二维码
  13. 冬令营第二天(1.19)
  14. 如何生成Patch及打patch
  15. x7 z8750 linux,GPD Pocket 7.0英寸 口袋笔记本电脑(Atom x7-Z8750、8GB、128GB、触屏)
  16. 浏览器访问百度www.baidu.com过程
  17. 北航计算机学院李卫国,北航学生评选“心目中最爱戴的老师”
  18. COC建筑拖动的实现
  19. 如何用PowerBI做损益计算书
  20. 【Word与MathType】出现报错并解决:Please restart Word to load MathType addin properly和“错误53,文件未找到MathPage.WLL”

热门文章

  1. 2.4 万余门在线课程免费开放!大量计算机相关课程.(赶紧收藏)
  2. mat-form-field must contain a MatFormFieldControl错误的解决方法
  3. CSS图片水平垂直居中
  4. vue 新版本 webpack 代理 跨域设置
  5. 100*100的 canvas 占多少内存?
  6. css多浏览常见问题
  7. block,inline,inline-block的区别
  8. 游戏、脑洞大开1(密码简单破译)
  9. java面向对象中的抽象,类与对象
  10. C8-2 圆的周长和面积 (100/100 分数)