摘要:
使用 Go 语言,我们可以轻松创建出 Web 服务,这一点比 Node.js 还要简单,今天就来总结一下 Go 语言中 Web 服务的创建方式。 首先,我们需要引入 net/http 这个包来处理 HTTP 请求,然后在指定的端口开启服务,下面来写一个最简单的 Web 服务程序: 上面代码中,我们会 阅读全文
摘要:
记得最早在学校机房学习 Java 时,照着书上的例子,写一个最简单 main 方法,当程序运行并在屏幕上打印出 hello world 时,内心竟有种莫名的激动,相信很多人都有这种经历吧。 不管学什么编程语言,都先从命令行程序搞起。 首先,我们来写一个 Go 语言版的 hello world 程序: 阅读全文
摘要:
上次我们分析了无状态组件生成 DOM 的过程,无状态组件其实就是纯函数,它不维护内部的状态,只是根据外部输入,输出一份视图数据。而今天我们介绍的有状态组件,它有内部的状态,因此在组件的内部,可以自行对状态进行更改,进而渲染出新的视图。下面我们就来分析有状态组件生成真实 DOM 结点的过程。 我们先来 阅读全文
摘要:
Process模块 (Features of Process) is a global variable which indicates the current Node.js process. It is actually an instance of , which is used to sub 阅读全文
摘要:
In normal development, we are likely to use 'console.log' for message logging, yet it’s simple, we are unfortunately not able to persist the messages 阅读全文
摘要:
CLI, as an abbreviation of Command-line Interface, can receive user's input and give an immediate response in terminal. In Node.js, globally installed 阅读全文