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
BabelJS Tutorialis the webpack.config.js file which will build the final file. webpack.config.js var path = require('path'); module.exports = { entry: { app: './src/main.js' }, output: /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/0 码力 | 173 页 | 2.70 MB | 1 年前3
Conan 2.0 Documentationlocking mechanism to avoid possible disruption from packages in ConanCenter that are updated and require latest Conan version. • Configuration and automatic tools detection, like the detection of the default all the artifacts, binaries, and build files that is completely independent of Conan and no longer require Conan at all to build. 10 Chapter 2. What’s new in Conan 2 Conan Documentation, Release 2.0.17 command. 2. Use a system installer, or create your own self-contained Conan executable, to not require Python in your system. 3. Running Conan from sources. 3.1 Install with pip (recommended) To install0 码力 | 652 页 | 4.00 MB | 1 年前3
共 1000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 100













