zoukankan      html  css  js  c++  java
  • [MEAN+ Webstrom] First API -- 2.Debug Node.js RESTful application

    Using WebStrom can easily debug the Node applcation.

    For example, we have an Node+Express application.

    server.js:

    /**
     * Created by Answer1215 on 12/9/2014.
     */
    'use strict';
    
    var expres = require('express');
    var app = expres();
    
    app.get('/', function(request, response) {
        response.send(200, "Hello world");
    });
    
    app.listen(3000);

    All it does just send back an "Hello World" string.

    What we want is to see how to use webstrom to debug this server.js and get "Hello World" string from the console.

    It will show:

    Then in the Tools bar, select RESTful Client:

    Set the HTTP method, Host/port, and Path, then click run, you will get "Hello world".

    Notice that, if you modify the server.js, you should rerun the debug to get the lastest modification.

    For example: We add a people path.

    /**
     * Created by Answer1215 on 12/9/2014.
     */
    'use strict';
    
    var expres = require('express');
    var app = expres();
    
    app.get('/', function(request, response) {
        response.send(200, "Hello world");
    });
    
    app.get('/people', function(request, response){
    
        response.json(200, "People yled");
    });
    
    app.listen(3000);

    After rerun the debug, In RESTful client, we get:

  • 相关阅读:
    ie条件注释
    css3之图片一闪而过特效
    css帧动画之图片发亮
    css3动画
    解决ie6不兼容透明图片
    jquery实现拖拽的效果
    原生js实现拖拽弹框的效果
    C++学习笔记十之连接数据库
    C++学习笔记九之异常处理
    C++学习笔记八之STL内置算法
  • 原文地址:https://www.cnblogs.com/Answer1215/p/4154574.html
Copyright © 2011-2022 走看看