zoukankan      html  css  js  c++  java
  • NodeJs学习历程

    NPM 使用介绍

    npm就相当于 java中的maven工程。使用它可以方便灵活的管理第三方依赖

    npm install npm -g

    一般用nodejs,可以用pm2管理

    安装方式: npm install pm2

    pm2常用命令: https://www.npmjs.com/package/pm2

    1.pm2 ls 查看node启动情况,列出由pm2管理的所有进程信息,还会显示一个进程会被启动多少次,因为没处理的异常
    2.pm2 monit 监视每个node进程 的cpu 和内存的使用情况
    3.pm2 restart 0 重启node并将node重启次数置为0
    4.pm2 start 0
    5.pm2 shop 0

    Node.js REPL(交互式解释器):

    这种交互模式跟python交互模式基本类似

    使用nodejs创建第一个应用步骤:

    var http = require('http');  

    http.createServer(function (request, response) {

        // 发送 HTTP 头部,HTTP 状态值: 200 : OK,内容类型: text/plain

        response.writeHead(200, {'Content-Type': 'text/plain'});

        // 发送响应数据 "Hello World"

        response.end('Hello World ');

    }).listen(8888);

    使用 ,http://127.0.0.1:8888  即可访问。

    Node.js 回调函数:

  • 相关阅读:
    git常用命令
    IDEA设置
    redis基础
    SQL 基础
    springboot 配置日志 打印不出来sql
    阿里巴巴开发规范最新版
    rabbitmq用户权限
    rabbitMQ配置文件
    RabbitMQ配置文件(rabbitmq.conf)
    C++模板编程:如何使非通用的模板函数实现声明和定义分离
  • 原文地址:https://www.cnblogs.com/pzyin/p/6737672.html
Copyright © 2011-2022 走看看