Introduction to Node.js(2)
1 How to recognize your Node.js files?
Node-js
|--- index.js
|--- server.js
index.js:
var server = require("./server.js");
server.start();
server.js:
var http = require("http");
function start() {
http.createServer(function(request, response) {
console.log("Receive a request.");
response.writeHead(200, {"Content-Type": "text/plain"});
response.write("Hello World");
response.end();
}).listen(8765, "127.0.0.1");
}
exports.start = start;
2 How to install an external module?
It’s very very easy. The only requirement is that your computer has been connected to Internet. The method to install Node.js modules is just like the way to install softwares on Linux using apt-get, or on Mac OS X using marport.
npm install SOME_MODULE
What does npm stand for?
Perhaps it is NodeJS Pakage Management.
3 How to use a module?
I guess you’ve already known that.
var yourModule = require("./someModule.js");
or
var module = require("module");
-
转载请注明来自柳大的CSDN博客:blog.csdn.net/poechant
-
分享到:
相关推荐
Chapter 1, Welcome to the Node.js Platform, serves as an introduction to the world of Node.js application design by showing the patterns at the core of the platform itself. It covers the Node.js ...
This book is the ideal introduction for JavaScript developers who want to create scalable server side applications using Node.js and Koa.js. The book shows you how Koa can be used to start projects ...
Part 1 provides an introduction to Node.js, teaching the fundamental techniques needed to develop with it. Chapter 1 explains the characteristics of JavaScript and Node and steps through example code....
JavaScript Applications with Node.js, React, React Native and MongoDB: Design, code, test, deploy and manage in Amazon AWS By 作者: Eric Bush ISBN-10 书号: 0997196661 ISBN-13 书号: 9780997196665 出版...
本书《Professional Node.js: Building JavaScript Based Scalable Software》深入讲解了如何使用Node.js构建可扩展的软件,并将重点放在了基于JavaScript的开发上。全书分为几个主要部分,覆盖了Node.js的安装与...
A practical introduction to Node.js, an exciting server-side JavaScript web development stack Overview Learn about server-side JavaScript with Node.js and Node modules. Website development both with...
Serverless Applications with Node.js walks you through building serverless apps on AWS using JavaScript. Inside, you'll discover what Claudia.js brings to the table as you build and deploy a scalable ...
2. **Node.js模块作者**:对于希望将平台API封装成一套同步或异步API的Node.js模块作者而言,libuv同样是一个重要的工具。尽管这份文档不会深入讨论如何在Node.js环境中使用libuv,但它提供了一些基本的概念和技术,...
This handbook is a getting started guide to Node.js, the server-side JavaScript runtime environment. The Node.js Handbook follows the 80/20 rule: learn in 20% of the time the 80% of a topic. Node.js ...
**部分内容**:NodeWebDevelopment,A practical introduction to Node, the exciting new server-side JavaScript web development stack. 3. **技术栈组成**: - **核心模块**:Node.js 自带了一系列内置模块,...
Anode builds to an Android application package (.apk) that encapsulates the node.js runtime and can run node.js applications through an intent-based API. Status This work is at an early stage. All ...
Node.js简介 这是Node.js上LinuxFoundationX(edX)的类 第2章 固定服务器,模拟GET路由 文件夹的名称设置路由的路径前缀。 因此,如果我们使用fastify.get('/foo', …)设置GET /foo路由 在/confectionery/文件夹中...
"introduction-to-nodejs-mongodb-meteor-master"这个文件名暗示这是一个开源项目,可能包含有关Node.js、MongoDB和Meteor的教程、示例代码或者一个简单的应用。项目中的文件和目录会详细展示如何在实际开发中结合这...
9. Express.js入门(Introduction to Express):Express.js是一个灵活的Node.js Web应用开发框架,提供了一系列强大的特性来快速地构建Web应用。 10. Express应用的架构(Architecture of an Express Application...
- **灵活性**:不仅可以用于前端开发,也可以结合后端框架(如Node.js)进行全栈开发。 - **广泛的应用场景**:适用于各种类型的网页开发,从小型个人项目到大型企业级应用程序。 ### JavaScript如何工作 当浏览器...