zoukankan      html  css  js  c++  java
  • 强哥node.js学习笔记

    node后端语言:

    nodejs学习大纲:
    1.node安装
    2.node repl开发
    3.node sublime开发
    4.node 使用
    5.node 中创建第一个应用
    6.node 回调函数
    7.node 事件循环
    8.node event事件
    9.node 模块系统
    10.node 函数
    11.node 路由
    12.node 全局对象
    13.node 文件系统
    14.node get和post请求
    15.node 工具模块
    16.node web模块
    17.html5+js+jsonp+php+node+mysql完成综合项目

    -------------------------------------------------------
    node和js关系:(http://www.techug.com/php-vs-node-js)
    1.php开发简单
    2.node执行简单快

    dos命令:
    start http://www.baidu.com //打开链接
    tasklist //查看进程
    taskkill /f /im chrome.exe //杀死进程
    netstat -ano | find "4445" //查看指定端口

    rpel开发:
    1.执行js代码
    node
    >arr = [1,2,3];
    >console.log(arr);
    2.执行js文件
    node index.js

    node npm安装模块:
    npm list //查看已安装的模块
    npm install mysql //安装mysql模块
    npm uninstall mysql //卸载mysql模块
    npm root //本地模块根目录
    npm root -g //本服务器所有模块根目录
    npm update mysql //升级mysql模块

    node中创建第一个应用(web服务器):
    const http=require('http');
    cs=function (req, res) {
    res.writeHead('200',{'content-type':'text/html;charset=utf-8'});
    res.write('hello world');
    res.end();
    }
    http.createServer(cs).listen(666);
    console.log('http is ok!');

    node回调函数:
    1.同步操作文件(阻塞I/O)
    2.异步操作文件(非阻塞I/O)

    function函数
    1.常用函数
    function show(){}
    2.匿名函数
    show=function(){}

    node路由:

    node全局变量:
    1.__filename
    2.__dirname
    3.setTimeout();
    4.setInterval();
    5.console();
    6.process();

    node常用工具:
    1.util.inspect
    2.util.isArray();
    3.util.isBoolean();
    4.util.isDate();
    5.util.isFunction();
    6.util.isObject();
    7.util.isRegExp();

    node文件系统:
    1.读取文件内容
    异步非阻塞读取readFile();
    同步阻塞读取readFileSync();
    2.写文件内容
    writeFile()
    3.删除文件
    unlink();
    4.创建目录
    mkdir();
    5.删除目录
    rmdir();

    node get和post请求:
    http=require('http');
    url = require('url');
    querystring=require('querystring');
    cs=function (req, res) {
    console.log(req.url);
    uri = req.url;
    if(uri!=='/favicon.ico'){
    str=url.parse(uri).query;
    json=querystring.parse(str);
    console.log(json);
    res.write('this is a web server!');
    res.end();
    }
    }
    http.createServer(cs).listen(8000);
    console.log('http server is ok!');

    os模块:
    1.os.tmpdir();
    2.os.hostname();
    3.os.type();
    4.os.platform();
    5.os.loadavg();
    6.os.totalmem();
    7.os.freemem();
    8.os.cpus();
    9.os.networkInterfaces();

    path模块:
    1.path.dirname();
    2.path.basename();
    3.path.extname();
    4.path.parse();
    5.path.format();

  • 相关阅读:
    atitit.交换机 汇聚上联、网络克隆和标准共享的原理与区别
    Atitit.数据库分区的设计 attilax  总结
    Atitit.数据库分区的设计 attilax  总结
    Atitit.常用分区api的attilax总结
    Atitit.常用分区api的attilax总结
    Atitit.  单列索引与多列索引 多个条件的查询原理与设计实现
    Atitit.  单列索引与多列索引 多个条件的查询原理与设计实现
    Atitit.sql where条件表达式的原理  attilax概括
    Atitit.sql where条件表达式的原理  attilax概括
    Atitit.分区对索引的影响 分区索引和全局索引 attilax总结
  • 原文地址:https://www.cnblogs.com/redheat/p/7069820.html
Copyright © 2011-2022 走看看