[Express + Webstrom] Debug node. JS RESTful Application

Source: Internet
Author: User

Using Webstrom can easily debug the Node applcation.

For example, we had an node+express application.

Server.js:

/**/' 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 a "Hello world" string.

What we want are to see how to use Webstrom to debug this server.js and get ' Hello world ' string from the console.

It'll show:

Then in the Tools bar, select RESTful Client:

Set the HTTP method, Host/port, and Path, then click Run, you'll 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.

/**/' use strict '; var expres = require (' Express '); var app = expres (); App.get (function(request, Response) {    response.send (200 , "Hello World"); App.get (function(request, Response) {    Response.json (+, "people yled");}); App.listen (3000);

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

[Express + Webstrom] Debug node. js RESTful Application

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.