[MEAN+ Webstrom] First API -- 2.Debug Node.js RESTful application

Using WebStrom can easily debug the Node applcation.web

For example, we have an Node+Express application.express

server.js:json

/**
 * 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.app

 

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

 

It will show:this

 

Then in the Tools bar, select RESTful Client:spa

 

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

 

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

For example: We add a people path.server

/**
 * 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:

相關文章
相關標籤/搜索