`
Poechant
  • 浏览: 212777 次
博客专栏
Bebe66e7-3a30-3fc9-aeea-cfa3b474b591
Nginx高性能Web服务...
浏览量:23519
5738817b-23a1-3a32-86de-632d7da73b1e
Cumulus实时媒体服务...
浏览量:21429
社区版块
存档分类
最新评论

Introduction to Node.js(2)

 
阅读更多

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

-

分享到:
评论

相关推荐

    Node.js Design Patterns Second Edition[July 2016]

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

    Server Side development with Node.js and Koa.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 ...

    Programming.Web.Applications.with.Node.Express.and.Pug

    Using Node.js alongside Express and Pug - the brand new version of Jade - you can create modern web applications solely using JavaScript. This book teaches you how to structure and build your app ...

    Node.js In Action 2nd Edition

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

    node.js in action

    The first chapter provides an overview of JavaScript and ES2015 for those of you who haven’t yet discovered the joys of modern JavaScript., Roadmap, This book is organized into three parts., Part 1 ...

    JavaScript Applications with Node.js, React, React Native and MongoDB

    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 出版...

    [Node] Node 网络应用开发 第2版 (英文版)

    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

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

    Node.Patterns.Databases.Volume.I.LevelDB.Redis.and.CouchDB

    Node.js has been designed to do quick and efficient network I/O. It's event-driven streams make it ideal to be used as a kind of smart proxy, often working as the glue between back-end systems and ...

    The Node.js Handbook 1st Edition.Pdf

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

    Rust-wasm-nodejs.pdf Rust ➡ WebAssembly Node.js

    Rust ➡ WebAssembly Node.js Introduction to SSVM is a high performance, extensible, and hardware optimized WebAssembly Virtual Machine for cloud, AI, and blockchain applications.

    Android代码-anode

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

    Introduction-to-Node.js:EdX培训课程将于2021年4月8日到期

    Node.js简介 这是Node.js上LinuxFoundationX(edX)的类 第2章 固定服务器,模拟GET路由 文件夹的名称设置路由的路径前缀。 因此,如果我们使用fastify.get('/foo', …)设置GET /foo路由 在/confectionery/文件夹中...

    Vue.js_ 11 Practical Projects.pdf

    7. An Introduction to Data Visualization with Vue and D3.js by Christopher Vundi 8. How to Build a Reusable Component with Vue by Deji Atoyebi 9. How to Build a Game with Vue.js by Ivaylo Gerchev 10. ...

    introduction-to-nodejs-mongodb-meteor:Node.js,MongoDB和Meteor简介

    Node.js,MongoDB和Meteor简介参加参与者对Node.js,MongoDB和Meteor的简要介绍 ###许可该源代码已获得GPL v3的许可。谢谢感谢所有贡献者

    Getting_Started_with_RabbitMQ_and_CloudAMQP.pdf

    Introduction to RabbitMQ ....................................................10 Microservices and RabbitMQ ..................................... 12 What is RabbitMQ?......................................

    JavaScript Security(PACKT,2014)

    This book starts off with an introduction to JavaScript security and gives you an overview of the basic functions JavaScript can perform on the Web, both on the client side and the server side....

    SitePoint.Vue.js.11.Practical.Projects

    An Introduction to Data Visualization with Vue and D3.js by Christopher Vundi How to Build a Reusable Component with Vue by Deji Atoyebi How to Build a Game with Vue.js by Ivaylo Gerchev Build a ...

    Beginning KeystoneJS(Apress,2016)

    Learn how to develop a complete and robust Node, express.js and MongoDB-based web application and mobile application backend quickly using KeystoneJS. You’ll learn how KeystoneJS makes complicated ...

    The.Definitive.Guide.to.MongoDB.3rd.Edition.1484211839

    The Third Edition also now includes Node.js along with Python. MongoDB is the most popular of the "Big Data" NoSQL database technologies, and it's still growing. David Hows from 10gen, along with ...

Global site tag (gtag.js) - Google Analytics