Node.js Manual & DocumentationContents Synopsis 概要 Global Objects 全局对象 o global o process o require() o require.resolve() o require.paths o __filename o __dirname o module Timers 定时器 o setTimeout(callback . o Loading from the `require.paths` Folders 从`require.paths`目 录中加载 Note:** Please Avoid Modifying `require.paths` **注意:** 请不要修改`requires.paths` Setting `require.paths` to some other value value does nothing. 将`require.paths`设为其他值不会产生任何作用 Putting relative paths in `require.paths` is... weird. 不建议在`require.paths`中发入相对路径 Zero Isolation 零隔离 Addenda: Package Manager Tips 附录:包管理技巧0 码力 | 153 页 | 1.21 MB | 1 年前3
Node.js - the coreargument and is named err Some libraries require following these conventions ex. Async.js See example on next slide 10 Node.js Callback Example 11 var fs = require('fs'); function readObject(filePath (err, obj) { if (err) { console.error(err); } else { console.log(obj); } }); fs = require 'fs' readObject = (filePath, cb) -> fs.readFile filePath, (err, buf) -> if !err try https://github.com/caolan/async 12 Node.js Async Example 13 var async = require('async'); var fs = require('fs'); var rimraf = require('rimraf'); // Unix "rm -rf" for Node var dirPath = 'foo'; var fileName0 码力 | 124 页 | 7.87 MB | 1 年前3
The Node.js Handbook
js application The most common example Hello World of Node.js is a web server: 11 const http = require('http') const hostname = '127.0.0.1' const port = 3000 const server = http.createServer((req way to load modules across all JavaScript, frontend or backend, but Node.js still supports the require syntax. 6. The V8 JavaScript Engine V8 is the name of the JavaScript engine that powers Google is done. Many times with Node.js we start servers, like this HTTP server: 25 const express = require('express') const app = express() app.get('/', (req, res) => { res.send('Hi!') })0 码力 | 161 页 | 1.66 MB | 1 年前3
Back to Basics Testing"gtest/gtest.h" std::string left_pad(std::string const& str, size_t min_len, char pad_char=' '); REQUIRE(left_pad("", 0) == ""); ASSERT_EQ(left_pad("", 0), "");58 TEST_CASE("left_pad pads strings to a left_pad(std::string const& str, size_t min_len, char pad_char=' '); REQUIRE(left_pad("", 0) == ""); ASSERT_EQ(left_pad("", 0), ""); REQUIRE(left_pad("abc", 0) == "abc"); ASSERT_EQ(left_pad("abc", 0), "abc"); left_pad(std::string const& str, size_t min_len, char pad_char=' '); REQUIRE(left_pad("", 0) == ""); ASSERT_EQ(left_pad("", 0), ""); REQUIRE(left_pad("abc", 0) == "abc"); ASSERT_EQ(left_pad("abc", 0), "abc");0 码力 | 79 页 | 25.86 MB | 6 月前3
Learning Gulp$ npm install --save-dev gulp 5. Create a gulpfile.js at the root of your project: var gulp = require('gulp'); gulp.task('default', function() { // place code for your default task here }); 6 parameters is an array of tasks to be executed and completed before your task will run: var gulp = require('gulp'); gulp.task('one', function() { // compile sass css }); gulp.task('two', function() Concat js file in sub folder using gulp var gulp = require('gulp'); // include plug-ins var uglify = require('gulp-uglify'), concat = require('gulp-concat'); // Minified file gulp.task('packjsMin'0 码力 | 45 页 | 977.19 KB | 1 年前3
Apache HTTP Server Documentation Version 2.4the API updates (p. 1023) overview. This document describes changes in server behavior that might require you to change your configuration or how you use the server in order to continue using 2.4 as you significant changes in authorization configuration, and other minor configuration changes, that could require changes to your 2.2 configuration files before using them for 2.4. Authorization Any configuration REQUIREALL. If you use MOD AUTHZ DBM, you must port your configuration to use Require dbm-group ... in place of Require group .... Access control In 2.2, access control based on client hostname, IP0 码力 | 1125 页 | 4.15 MB | 1 年前3
Apache HTTP Server Documentation Version 2.4the API updates (p. 1009) overview. This document describes changes in server behavior that might require you to change your configuration or how you use the server in order to continue using 2.4 as you significant changes in authorization configuration, and other minor configuration changes, that could require changes to your 2.2 configuration files before using them for 2.4. Authorization Any configuration REQUIREALL. If you use MOD AUTHZ DBM, you must port your configuration to use Require dbm-group ... in place of Require group .... Access control In 2.2, access control based on client hostname, IP0 码力 | 1111 页 | 4.11 MB | 1 年前3
Apache HTTP Server Documentation Version 2.4the API updates (p. 931) overview. This document describes changes in server behavior that might require you to change your configuration or how you use the server in order to continue using 2.4 as you significant changes in authorization configuration, and other minor configuration changes, that could require changes to your 2.2 configuration files before using them for 2.4. Authorization Any configuration REQUIREALL. If you use MOD AUTHZ DBM, you must port your configuration to use Require dbm-group ... in place of Require group .... Access control In 2.2, access control based on client hostname, IP0 码力 | 1031 页 | 3.23 MB | 1 年前3
Apache HTTP Server Documentation Version 2.4the API updates (p. 931) overview. This document describes changes in server behavior that might require you to change your configuration or how you use the server in order to continue using 2.4 as you significant changes in authorization configuration, and other minor configuration changes, that could require changes to your 2.2 configuration files before using them for 2.4. Authorization Any configuration REQUIREALL. If you use MOD AUTHZ DBM, you must port your configuration to use Require dbm-group ... in place of Require group .... Access control In 2.2, access control based on client hostname, IP0 码力 | 1031 页 | 3.23 MB | 1 年前3
NodeJS 中文文档 V0.2.3Synopsis Synopsis Synopsis Synopsis 总述 总述 总述 总述 使用 node 实现的 web 服务器示例,它返回'Hello World': var http = require('http'); http.createServer(function (request, response) { response.writeHead(200, {'Content-Type': 标准模块 node 附带了一些模块,这些模板都被编译进了 node 二进制文件中,其中大部分将在下文介绍。 使用这些模块 最常见的方法是调用“require('name')”并将返回值赋给一个和模块同名的局部变量。 例如: var sys = require('sys'); 同样可以使用其他模块扩展 node。 详情参看"模块"章节。 Buffers Buffers Buffers Buffers 原始的数据保存在 Buffer 类的实例中。Buffer 类似于一个整数数组,不同之处在于它和在 V8内存堆之外分配的 一段内存数据相对应。Buffer 对象的大小不能调整。你可以通过"require('buffer').Buffer"来使用这个类。 Buffer 对象是全局对象。 Buffer 和 Javascirpt 中 string 对象之间的转换需要指定编码方式。如下是 node0 码力 | 62 页 | 542.14 KB | 1 年前3
共 1000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 100













